X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/ca2eac75cbed9c8e9df76aeff10fc1e1dea41465..596c5c5fd32e20997b49312af1aae8fd588a0f69:/dot/xinitrc diff --git a/dot/xinitrc b/dot/xinitrc index 9875cad..210a76d 100755 --- a/dot/xinitrc +++ b/dot/xinitrc @@ -156,13 +156,17 @@ start-clients-local () { :; } start-clients () { ## Gnome session. - case "$vnc,$(gnome-session --version 2>&1)" in - no,gnome-session\ 2.3[2-9].* | \ - no,gnome-session\ 2.4[0-9].* | \ - no,gnome-session\ 2.[1-9][0-9][0-9]*) + case "$vnc,$(xfce4-session --version 2>&1),$(gnome-session --version 2>&1)" + in + no,xfce4-session*) + run bginit xfce4-session + ;; + no,*,gnome-session\ 2.3[2-9].* | \ + no,*,gnome-session\ 2.4[0-9].* | \ + no,*,gnome-session\ 2.[1-9][0-9][0-9]*) run bginit gnome-session --session mdw ;; - no,*) + no,*,gnome-session*) run bginit gnome-session ;; esac @@ -348,17 +352,27 @@ session-running-p () { >/dev/null 2>&1 } +dbus-service-running-p () { + dbus-send >/dev/null 2>&1 --session --print-reply \ + --dest=org.freedesktop.DBus / \ + org.freedesktop.DBus.GetNameOwner string:$1 +} + kill-gnome-session () { - if session-running-p; then - info "killing Gnome session manager" - dbus-send --session \ - --dest=org.gnome.SessionManager /org/gnome/SessionManager \ - org.gnome.SessionManager.Logout uint32:2 - for i in 1 2 3 4 5; do - sleep 1 - if ! session-running-p; then break; fi - done - fi + win=nil + while read service object logout; do + if dbus-service-running-p $service; then win=t; break; fi + done <