From bf74b670f65b14b5c0ced54d24628919de53bc7a Mon Sep 17 00:00:00 2001 From: Giuseppe Fierro Date: Tue, 26 Sep 2023 15:24:10 +0200 Subject: [PATCH 1/4] code.sh: Add Electron flags for improved UX under Wayland --- code.sh | 18 ++++++++++++++++++ com.visualstudio.code.yaml | 1 + 2 files changed, 19 insertions(+) diff --git a/code.sh b/code.sh index de8d0ec..eb24aab 100755 --- a/code.sh +++ b/code.sh @@ -4,6 +4,7 @@ set -e shopt -s nullglob FIRST_RUN="${XDG_CONFIG_HOME}/flatpak-vscode-first-run" +WAYLAND_OPTS="" function msg() { echo "flatpak-vscode: $*" >&2 @@ -14,6 +15,22 @@ if [ ! -f ${FIRST_RUN} ]; then touch ${FIRST_RUN} fi +if [ ! -f ${FIRST_RUN} ]; then + WARNING_FILE="/app/share/vscode/flatpak-warning.txt" + touch ${FIRST_RUN} +fi + +if [[ $XDG_SESSION_TYPE == "wayland" && -e "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]] +then + WAYLAND_OPTS="$WAYLAND_OPTS --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations,WebRTCPipeWireCapturer" + if [ -c /dev/nvidia0 ] + then + WAYLAND_OPTS="$WAYLAND_OPTS --disable-gpu-sandbox" + fi +else + WAYLAND_OPTS="$WAYLAND_OPTS --enable-features=WebRTCPipeWireCapturer" +fi + PYTHON_SITEDIR=$(python3 < Date: Sat, 7 Oct 2023 10:54:47 +0200 Subject: [PATCH 2/4] Change permession socket=fallback-x11 --- com.visualstudio.code.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.visualstudio.code.yaml b/com.visualstudio.code.yaml index 3c69d98..b6efb73 100644 --- a/com.visualstudio.code.yaml +++ b/com.visualstudio.code.yaml @@ -12,8 +12,8 @@ finish-args: - --require-version=0.10.3 - --share=network - --share=ipc - - --socket=x11 - --socket=wayland + - --socket=fallback-x11 - --socket=pulseaudio - --socket=ssh-auth - --device=all From 2c1730c9b5a1fc52059a139c638c58087a53a22d Mon Sep 17 00:00:00 2001 From: Lasath Fernando Date: Wed, 10 Jul 2024 23:23:31 -0500 Subject: [PATCH 3/4] Address @bilelmoussaoui 's code reveiw comment --- code.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code.sh b/code.sh index eb24aab..b965ecb 100755 --- a/code.sh +++ b/code.sh @@ -15,11 +15,6 @@ if [ ! -f ${FIRST_RUN} ]; then touch ${FIRST_RUN} fi -if [ ! -f ${FIRST_RUN} ]; then - WARNING_FILE="/app/share/vscode/flatpak-warning.txt" - touch ${FIRST_RUN} -fi - if [[ $XDG_SESSION_TYPE == "wayland" && -e "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]] then WAYLAND_OPTS="$WAYLAND_OPTS --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations,WebRTCPipeWireCapturer" From 58d399b844f2f50a4bc3b811ba38cfab03be4194 Mon Sep 17 00:00:00 2001 From: Lasath Fernando Date: Thu, 11 Jul 2024 00:19:21 -0500 Subject: [PATCH 4/4] Fix bug preventing starting --- code.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code.sh b/code.sh index b965ecb..b89d78a 100755 --- a/code.sh +++ b/code.sh @@ -15,7 +15,7 @@ if [ ! -f ${FIRST_RUN} ]; then touch ${FIRST_RUN} fi -if [[ $XDG_SESSION_TYPE == "wayland" && -e "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]] +if [[ $XDG_SESSION_TYPE == "wayland" && -e "$WAYLAND_DISPLAY" ]] then WAYLAND_OPTS="$WAYLAND_OPTS --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations,WebRTCPipeWireCapturer" if [ -c /dev/nvidia0 ]