From 46cab9b14a97b1c9ff4dc748c9c703244532fccc Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Mon, 15 Apr 2024 10:57:54 +0300 Subject: [PATCH] bash/usr-local-bin/code: add snap/system support, disable wayland --- bash/usr-local-bin/code | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/bash/usr-local-bin/code b/bash/usr-local-bin/code index 53196ed..6ebf570 100755 --- a/bash/usr-local-bin/code +++ b/bash/usr-local-bin/code @@ -1,5 +1,26 @@ #!/usr/bin/env bash +# TODO! Enable wayland support by swapping x11 with auto! Currently broken. +# https://github.com/microsoft/vscode/issues/202072 + set -x -flatpak run com.visualstudio.code --no-sandbox --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations "$@" +if [ -f /usr/bin/code ]; then + /usr/bin/code --verbose --enable-features=WaylandWindowDecorations,UseOzonePlatform --ozone-platform-hint=x11 "$@" + +elif [ -f /snap/bin/code ]; then + # https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1951491/comments/104 + #unset DBUS_SESSION_BUS_ADDRESS + # https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1951491/comments/105 + #export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus + snap run code --verbose --enable-features=WaylandWindowDecorations,UseOzonePlatform --ozone-platform-hint=x11 "$@" + +elif [ -f ~/.local/share/flatpak/exports/bin/run/com.visualstudio.code ]; then + flatpak run --user com.visualstudio.code --verbose --no-sandbox --ozone-platform-hint=x11 --enable-features=WaylandWindowDecorations "$@" + +elif [ -f ~/.local/share/flatpak/exports/bin/run/com.visualstudio.code ]; then + flatpak run com.visualstudio.code --verbose --no-sandbox --ozone-platform-hint=x11 --enable-features=WaylandWindowDecorations "$@" + +else + echo "code not found :(" +fi set +x