Skip to content

Commit

Permalink
Prevent $DISPLAY from being overridden in SSH (for X11 forwarding)
Browse files Browse the repository at this point in the history
When trying to ssh into a qubes vm, `/etc/profile.d/qubes-gui.sh` will
improperly set `$DISPLAY` to be :0. When X11 forwarding is used, `$DISPLAY`
is automatically set to ensure that the relevant windows get forwarded
to the ssh client. However, since qubes-gui.sh is called after a
successful login, the correct value for `$DISPLAY` will be overridden.

This commit fixes the issue by adding a test in qubes-gui.sh to check if
we are currently in an ssh session (by checking if `$SSH_CLIENT` or
`$SSH_TTY` are set).

Note: I do not know .csh scripts and have not tested the proposed change
to qubes-gui.csh, yet.
  • Loading branch information
InnovativeInventor committed Sep 26, 2024
1 parent bc2f589 commit 4045238
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions appvm-scripts/etc/profile.d/qubes-gui.csh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
setenv DISPLAY ":0"
setenv _JAVA_AWT_WM_NONREPARENTING "1"
if (! ($?SSH_CLIENT || $SSH_TTY)) ; then
setenv DISPLAY ":0"
setenv _JAVA_AWT_WM_NONREPARENTING "1"
endif
if ( -f /var/run/qubes-service/software-rendering )
setenv GSK_RENDERER "cairo"
setenv GDK_DEBUG "gl-disable vulkan-disable"
Expand Down
4 changes: 3 additions & 1 deletion appvm-scripts/etc/profile.d/qubes-gui.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export DISPLAY=:0 _JAVA_AWT_WM_NONREPARENTING=1
if ! ([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] ]); then
export DISPLAY=:0 _JAVA_AWT_WM_NONREPARENTING=1
fi
if test -f /var/run/qubes-service/software-rendering; then
export GSK_RENDERER="cairo" GDK_DEBUG="gl-disable vulkan-disable" \
LIBGL_ALWAYS_SOFTWARE=1
Expand Down

0 comments on commit 4045238

Please sign in to comment.