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 <