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

Log out of KDE programmatically

Tags: None
(comma "," separated)
elkvis
Registered Member
Posts
4
Karma
0

Log out of KDE programmatically

Thu Jan 05, 2012 4:16 pm
I'm developing a kiosk based on Fedora 16 and KDE 4.7.3. I have already figured out how to disable the desktop and panel (with help from other forum members) but now I'd like to find a way to programmatically log out of KDE when one of my technicians visits a kiosk to perform maintenance or repairs. is there a process for doing this? it doesn't matter if it shows the log out confirmation dialog or not, since it's only going to be my company's technicians making use of the feature.
lamarque
Registered Member
Posts
152
Karma
2
OS

Re: Log out of KDE programmatically

Thu Jan 05, 2012 9:56 pm
you can use:

qdbus org.kde.ksmserver /KSMServer logout 0 2 0

to shutdown the computer.

Look at /usr/include/kworkspace/kworkspace.h to understand what those three numbers mean. They are respectively called ShutdownConfirm, ShutdownType, and ShutdownMode.


Software engineer at Petrobrás http://www.petrobras.com.br/en/about-us/
KDE's Network Management maintainer
elkvis
Registered Member
Posts
4
Karma
0

Re: Log out of KDE programmatically

Thu Jan 05, 2012 10:36 pm
I'd prefer to do it without spawning an external program if possible. for example, win32 has ExitWindowsEx(). does KDE have anything similar?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: Log out of KDE programmatically

Fri Jan 06, 2012 1:03 am
You should be able to use QtDBus to make this call over D-Bus.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
lamarque
Registered Member
Posts
152
Karma
2
OS

Re: Log out of KDE programmatically

Fri Jan 06, 2012 1:46 pm
elkvis wrote:I'd prefer to do it without spawning an external program if possible. for example, win32 has ExitWindowsEx(). does KDE have anything similar?


Well, /usr/include/kworkspace/kworkspace.h is a C++ header. If your program is in C++ you can include it and use KWorkSpace::requestShutDown(...) directly.


Software engineer at Petrobrás http://www.petrobras.com.br/en/about-us/
KDE's Network Management maintainer


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kde-naveen, Sogou [Bot], Yahoo [Bot]