This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Signals when PC is going to sleep/hibernate or disconnecting

Tags: None
(comma "," separated)
Spomky
Registered Member
Posts
15
Karma
0
OS
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?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
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]
Spomky
Registered Member
Posts
15
Karma
0
OS
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.
Spomky
Registered Member
Posts
15
Karma
0
OS
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.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
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]


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]