Skip to content

Commit

Permalink
xstartup.turbovnc: TVNC_SHAREDDBUS = TVNC_USERDBUS
Browse files Browse the repository at this point in the history
We may eventually adopt this as an official option, and "user D-Bus" is
more correct terminology.  This commit also causes xstartup.turbovnc to
ignore TVNC_USERDBUS unless DBUS_SESSION_BUS_ADDRESS is set to the
per-user D-Bus session bus instance provided by systemd.
  • Loading branch information
dcommander committed Aug 8, 2024
1 parent 9f92916 commit af9fd5e
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions unix/xstartup.turbovnc
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ unset WAYLAND_DISPLAY
# attempt to display to a local Wayland session if one is active. This forces
# those applications to display to the TurboVNC session.
GDK_BACKEND=x11; export GDK_BACKEND
# If each TurboVNC session will run a (reasonably modern) window manager, then
# each TurboVNC session must have a separate D-Bus session bus instance. On
# Red Hat/Fedora (and derivatives), SuSE/openSUSE, FreeBSD, and Solaris 11,
# xinitrc and Xsession automatically create a new session bus instance if the
# If a TurboVNC session will run a (reasonably modern) window manager, then the
# session must have a D-Bus session bus instance. On Red Hat/Fedora (and
# derivatives), SuSE/openSUSE, FreeBSD, and Solaris 11, xinitrc and Xsession
# automatically create a new session bus instance if the
# DBUS_SESSION_BUS_ADDRESS environment variable is empty, so we used to unset
# that variable at this point in the script. However, on other operating
# systems (particularly Debian 10+ and Ubuntu 18.04+), it is necessary to
Expand All @@ -47,12 +47,20 @@ GDK_BACKEND=x11; export GDK_BACKEND
# Using a separate D-Bus session bus instance for each TurboVNC session is
# necessary in order to run multiple TurboVNC sessions (or a local session and
# a TurboVNC session) simultaneously under the same user account, but this also
# causes issues with cgroup v2 on some systems. We allow users to set
# TVNC_SHAREDDBUS=1 in the environment (currently undocumented except here) to
# forego a separate D-Bus session bus instance and use the D-Bus session bus
# instance provided by systemd, which improves cgroup v2 compatibility at the
# expense of multi-session capability.
if [ "$TVNC_SHAREDDBUS" != "1" ]; then
# causes issues with Control Group (cgroup) v2 on some systems. If
# TVNC_USERDBUS is set to 1 in the environment (currently undocumented except
# here), then we forego creating a unique D-Bus session bus instance for the
# TurboVNC session and use the per-user D-Bus session bus instance provided by
# systemd instead. That improves cgroup v2 compatibility at the expense of
# multi-session capability.
case "$DBUS_SESSION_BUS_ADDRESS" in
unix:path=/run/user/*)
;;
*)
unset TVNC_USERDBUS
;;
esac
if [ "$TVNC_USERDBUS" != "1" ]; then
DBUS_LAUNCH=
if [ -x /usr/bin/dbus-launch ]; then
DBUS_LAUNCH=/usr/bin/dbus-launch
Expand Down

0 comments on commit af9fd5e

Please sign in to comment.