From 4c6606a58fd3eff872ebf5bc5cc4adad029f233c Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Sat, 21 Sep 2013 08:59:48 +0200 Subject: xinitrc: Use dbus session from $XDG_RUNTIME_DIR if available That means systemd --user started dbus.socket :) --- .xinitrc | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.xinitrc b/.xinitrc index 3516cd8..6e8d292 100644 --- a/.xinitrc +++ b/.xinitrc @@ -11,17 +11,22 @@ unset command -# temporarily unset XDG_SESSION_COOKIE so consolekit launches a new session -realxdgcookie="$XDG_SESSION_COOKIE" -XDG_SESSION_COOKIE= -# run all system xinitrc shell scripts which will update $command -if [ -d /etc/X11/xinit/xinitrc.d ]; then - for i in /etc/X11/xinit/xinitrc.d/* ; do - [[ -x "$i" ]] && . "$i" - done +if [ -S $XDG_RUNTIME_DIR/dbus/user_bus_socket ] +then + export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/dbus/user_bus_socket +else + # temporarily unset XDG_SESSION_COOKIE so consolekit launches a new session + realxdgcookie="$XDG_SESSION_COOKIE" + XDG_SESSION_COOKIE= + # run all system xinitrc shell scripts which will update $command + if [ -d /etc/X11/xinit/xinitrc.d ]; then + for i in /etc/X11/xinit/xinitrc.d/* ; do + [[ -x "$i" ]] && . "$i" + done + fi + # restore XDG_SESSION_COOKIE + XDG_SESSION_COOKIE="$realxdgcookie" + unset realxdgcookie fi -# restore XDG_SESSION_COOKIE -XDG_SESSION_COOKIE="$realxdgcookie" -unset realxdgcookie exec $command $(XSESSION="${2:-${XSESSION}}" /etc/X11/chooser.sh) -- cgit