Registered Member
|
Hello!
I want to execute some actions when computer prepares to sleep/hibernate or when the user disconnects the session. Is there a class in the API or any DBus object that provides this kind of signal? |
Administrator
|
At this time, such signals are not available, however a series of scripts are run on sleep / hibernate and resume from sleep / hibernate depending on the framework used. For the user disconnecting from the session, you may wish to check ConsoleKit.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
Thank you for your answer.
It does not matter if I can not get signals when computer is going sleep or hibernate. I read the documentation of ConsoleKit and try to get signals but it is not what I need: signal is emitted when the session is closed, my process is already stopped and it can not receive the signal. I need a signal that occurred when the user decided to close the session and before the session is really closed. |
Registered Member
|
I found another way to know when session is closed.
I have a KDED Module in my project. When the session is closed, the KDED Module is stopped. I've just create a new signal and in the destructor of my KDED Moudle, I emit it. It seems to work fine. |
Administrator
|
In this case, you need to look at the X Session Management Protocol ( XSMP ) which is used by KDE, GNOME, XFCE, etc.
If you are implementing a KDE application, and using a KMainWindow based window or one of its subclasses, then please see the KMainWindow documentation ( http://api.kde.org/4.x-api/kdelibs-apid ... indow.html ). If you are not using KMainWindow, please see the KSessionManager documentation. If you are implementing a Qt application, please see http://doc.trolltech.com/4.6/qsessionmanager.html Note that adding KDE Daemon modules unless really needed is not recommended.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]