void-packages/srcpkgs/vscode/patches/libgl.patch

36 lines
1.3 KiB
Diff

diff --git a/resources/linux/bin/code.sh b/resources/linux/bin/code.sh
index 55f50b6f1c14..f03839c66095 100755
--- a/resources/linux/bin/code.sh
+++ b/resources/linux/bin/code.sh
@@ -30,6 +30,10 @@ else
fi
fi
+if [ -e "${HOME}/.config/Code - OSS/.libgl_always_software" ]; then
+ export LIBGL_ALWAYS_SOFTWARE=1
+fi
+
ELECTRON="$VSCODE_PATH/@@NAME@@"
CLI="$VSCODE_PATH/resources/app/out/cli.js"
ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
diff --git a/resources/linux/code.desktop b/resources/linux/code.desktop
index f93060d565bd..d511dd86489d 100644
--- a/resources/linux/code.desktop
+++ b/resources/linux/code.desktop
@@ -2,7 +2,7 @@
Name=@@NAME_LONG@@
Comment=Code Editing. Redefined.
GenericName=Text Editor
-Exec=/usr/share/@@NAME@@/@@NAME@@ --unity-launch %F
+Exec=/usr/bin/sh -c '[ -e "${HOME}/.config/Code - OSS/.libgl_always_software" ] && export LIBGL_ALWAYS_SOFTWARE=1; /usr/lib/@@NAME@@/@@NAME@@ --unity-launch %F'
Icon=@@ICON@@
Type=Application
StartupNotify=true
@@ -14,5 +14,5 @@ Keywords=vscode;
[Desktop Action new-empty-window]
Name=New Empty Window
-Exec=/usr/share/@@NAME@@/@@NAME@@ --new-window %F
+Exec=/usr/bin/sh -c '[ -e "${HOME}/.config/Code - OSS/.libgl_always_software" ] && export LIBGL_ALWAYS_SOFTWARE=1; /usr/lib/@@NAME@@/@@NAME@@ --new-window %F'
Icon=@@ICON@@