Hi Pat and Crew,
Currently in slackware there are a number of methods used for starting the session dbus in the xinitrc and display manager scripts (also wayland scripts). It would be nice to see them updated for consistency, particularly around their use of the variable DBUS_SESSION_BUS_ADDRESS.
What should happen is that if this variable is set (e.g. the user started their own session dbus), then don't launch a dbus instance and use the existing one, else launch a new one. Currently most scripts already do this in one way or another, but there are a few that could use fixing.
I have gone through all the scripts and I will summarize my findings here. Hopefully you see what I mean:
Plasma:
Plasma is packaged with the script "/usr/lib64/plasma-dbus-run-session-if-needed", which checks the DBUS_SESSION_BUS_ADDRESS variable and launchs a dbus if needed. However this script is only used in the starting of wayland from the display manager in /usr/share/wayland-sessions/plasmawayland.desktop:
Code:
Exec=/usr/lib64/plasma-dbus-run-session-if-needed /usr/bin/startplasma-wayland
In the x11 version at /usr/share/xsessions/plasma.desktop we have:
Code:
Exec=dbus-run-session /usr/bin/startplasma-x11
Which launches a dbus unconditionally. This could be changed to use plasma-dbus-run-session-if-needed to allow for checking DBUS_SESSION_BUS_ADDRESS.
In /etc/X11/xinit/xinitrc.kde we currently have this at the end:
Code:
else
dbus-launch --sh-syntax --exit-with-session startplasma-x11
fi
Which also starts its own dbus unconditionally. Why not reuse plasma-dbus-run-session-if-needed again and allow for that flexibility?
Also in /usr/bin/startkwayland the line is:
Code:
dbus-launch --sh-syntax --exit-with-session /usr/bin/startplasma-wayland
Once again that could be changed to use plasma-dbus-run-session-if-needed. If its already used for the plasmawayland.desktop launch, why not all of plasmas launching scripts?
Xfce:
Both the xfce.desktop and xinitrc.xfce files run /usr/bin/startxfce4 directly, which checks for DBUS_SESSION_BUS_ADDRESS already and starts one only if needed. No changes required.
Fluxbox & Blackbox:
These are launched with /usr/bin/startfluxbox and /usr/bin/startblackbox respectively. Both these scripts check for DBUS_SESSION_BUS_ADDRESS and start a dbus if needed, no change required.
Fvwm2:
The xinitrc.fvwm2 script launches a dbus unconditionally with this:
Code:
dbus-launch --exit-with-session /usr/bin/startfvwm2
However, the /usr/bin/startfvwm2 script checks for DBUS_SESSION_BUS_ADDRESS and starts its own if needed. The "dbus-launch --exit-with-session" can be removed and startfvwm2 will take care of that instead (which seems like that scripts only purpose anyway).
WindowMaker:
This one also launches dbus unconditionally in xinitrc.wmaker with:
Code:
exec dbus-launch --exit-with-session /usr/bin/wmaker $NOCPP
This one needs a dbus and will not launch its own. However, it would be nice if it was consistent with the rest and ran if needed. E.g. modified to this: (or just use plasmas start-if-needed script :-)
Code:
if [ -z "$DESKTOP_SESSION" -a -x /usr/bin/ck-launch-session ]; then
exec ck-launch-session dbus-launch --exit-with-session /usr/bin/wmaker $NOCPP
elif [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
exec dbus-launch --exit-with-session /usr/bin/wmaker $NOCPP
else
exec /usr/bin/wmaker $NOCPP
fi
MWM:
The xinitrc.mwm script already checks for DBUS_SESSION_BUS_ADDRESS and starts one only if needed, no change required.
TWM:
Doesn't do anything with dbus sessions.
So really just plasma, windowmaker, and fvwm2 could be changed, then they all would have consistent behavior in checking DBUS_SESSION_BUS_ADDRESS and starting dbus if needed. That would provide flexability for a user to be able to start their own dbus and have it used into the graphical session, rather than launching more unnecessary ones.
There is one quirk to all this. In the top of /usr/bin/startx there is the line:
Code:
unset DBUS_SESSION_BUS_ADDRESS
I don't understand why thats done upstream. The git commit said it was to allow for running startx in an already running session and not much else. (
https://gitlab.freedesktop.org/xorg/...689a2c3da49af9) Im not sure what the benefit of that is though...
Unsetting the dbus variable breaks the intended behavior of checking and only starting a dbus if needed in the following xinitrc scripts after running startx. If the majority of DEs and WMs already check for this properly then why does startx have to break the detection logic?
It would be nice if that was "patched" with a comment in front. I noted that arch linux does this in their own patch here:
https://github.com/archlinux/svntogi.../fs46369.patch
Sorry for the long read but this usage of DBUS_SESSION_BUS_ADDRESS is a across a few places. These changes shouldn't affect anything except opening up the ability to use DBUS_SESSION_BUS_ADDRESS for its intended purpose.