I want to write a script that runs in the background and detects when a user logs out. I am having trouble finding documentation on dbus-monitor. The best I can do is that I see a flurry of EndSessionQuery
, EndSession
, and EndSessionResponse
but these all come with booleans so they can't fully be trusted (maybe a program says it doesn't want the user to logout?) and on top of that, what if no programs are open? This is too unreliable.
What I want is to listen for a signal that will always happen when the user is logging out. Can someone provide that signal? Currently I am running this command:
dbus-monitor --session \
"type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'" | \
myprog
which catches the ScreenSaver events. But I also want to catch logout. What I wish for is something like:
dbus-monitor --session \
"type='signal',interface='org.gnome.Session',member='LogoutSuccess'" \
"type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'" | \
myprog
Look for the files called org.gnome.SessionManager.* here: http://git.gnome.org/browse/gnome-session/tree/gnome-session
There is a SessionOver signal in the interface org.gnome.SessionManager that may be what you need.
Are you looking for the normal "session is ending, quit yourself or put up a prompt or something" request from the session manager, or a "session is really ending now, bye bye" signal?
This is an old thread, but I'm adding some info in case anyone else needs it.
I had the same needs, but ended up implementing a Session Manager DBus client as an easy to use script. It executes a user-defined script on logout. The ready to use application is shared on GitHub.
Gnome EndSession DBus client
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With