In Gnome, what signal on the dbus monitor indicates that the user is logging out?

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 a dbus monitor. The best I can do is that I see that I am excited EndSessionQuery , EndSession and EndSessionResponse , but they all have logical values, so they cannot be completely trusted (maybe the program says that it does not want the user to exit? ) and, besides, what if no programs are open? This is too unreliable.

I want to listen to a signal that will always occur when a user logs out. Can anyone provide this signal? I am currently executing this command:

 dbus-monitor --session \ "type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'" | \ myprog 

which captures ScreenSaver events. But I also want to catch a way out. I wish for something like:

 dbus-monitor --session \ "type='signal',interface='org.gnome.Session',member='LogoutSuccess'" \ "type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'" | \ myprog 
+4
source share
2 answers

Look for files called org.gnome.SessionManager. * here: http://git.gnome.org/browse/gnome-session/tree/gnome-session

There is a SessionOver signal in the org.gnome.SessionManager interface, which may be what you need.

Are you looking for a normal "session ends, lose your temper, or make a request or something" from the session manager, or "session really ends now, bye bye" ??

+3
source

This is an old thread, but I'm adding some information in case someone needs it.

I had the same needs, but in the end I used the DBus Session Manager client as an easy-to-use script. It executes a user script on logout. The ready-to-use application is shared with GitHub.

Gnome EndSession DBus Client

0
source

All Articles