Skip to content

Commit

Permalink
feat: Use Xpra in desktop mode with Openbox
Browse files Browse the repository at this point in the history
Compared to using the Xpra HTML5 client in window mode, the desktop mode
features much better window management thanks to the battle-proven
Openbox WM. The two most noticable improvements are:

1. The Capella main window automatically is fullscreened, removing the
   unneeded window decorations and making it always follow the browser
   window size, just like for Xrdp based sessions.

2. Modal dialogs (like the "New Project" or "Properties" dialogs) now
   properly stay on top of the Capella main window. Previously, they
   could disappear behind the main window. This avoids the awkward
   situations where a hidden modal dialog prevents interaction with the
   main window, making it appear completely frozen.

The Xvfb instance spawned by Xpra is configured to use 96 DPI. This
avoid issues with Openbox seeing a way too high resolution during early
startup, before the client has connected, and assuming a HighDPI
display. Scaling is actually done client-side by the browser (by
reporting a downscaled resolution to Xpra), and Openbox applying its own
scaling settings would result in irritating issues like oversized mouse
cursors.

Setting the DPI happens in a small wrapper script, which is called by
Xpra instead of the actual `openbox-session` executable. This allows the
setting to be applied early enough to also affect Openbox itself,
instead of only the Capella instance started by its autostart script.
  • Loading branch information
Wuestengecko committed Oct 11, 2024
1 parent baa0786 commit 0acb4d0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions remote/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ RUN wget -qO /usr/share/keyrings/xpra.asc ${XPRA_REGISTRY}/xpra.asc && \
nginx && \
rm -rf /var/lib/apt/lists/*

COPY openbox-launcher.sh /usr/local/bin/openbox-launcher.sh
COPY rc.xml /etc/xdg/openbox/rc.xml
COPY menu.xml /etc/xdg/openbox/menu.xml
RUN printf '\nGTK_IM_MODULE=ibus\n' >> /etc/environment

# Setup Nitrogen (Desktop background)
COPY wallpaper.png /tmp/wallpaper.png
Expand Down
10 changes: 10 additions & 0 deletions remote/openbox-launcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors
# SPDX-License-Identifier: Apache-2.0

xrdb -merge <<\EOF
Xft.dpi: 96
EOF

exec openbox-session
2 changes: 1 addition & 1 deletion remote/supervisord.xpra.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

[program:xpra]
command=xpra start :10 --start=/home/techuser/.config/openbox/autostart --start-env=GTK_IM_MODULE=ibus --attach=yes --daemon=no --bind-tcp=0.0.0.0:10001 --min-quality=70
command=xpra start-desktop :10 --start=/usr/local/bin/openbox-launcher.sh --attach=yes --daemon=no --bind-tcp=0.0.0.0:10001 --min-quality=70
user=techuser
autorestart=true
environment=DISPLAY=":10",XPRA_DEFAULT_CONTENT_TYPE="text",XPRA_DEFAULT_VFB_RESOLUTION="1920x1080"
Expand Down

0 comments on commit 0acb4d0

Please sign in to comment.