Registered Member
|
Well friends, I had been a lot of days looking for this information to resolve a problem that I need to do programming with C++ and I do not find anything.
Well that question is this. I need with a program write in C++, to check when a session in KDE is started, and who are the user that start the session, this is the first thing, the second one is that the program have to extract a list whit the names of all the process started by the user, and the last one, the program have to be available to send orders (commands) to the Kdesktop of the user, like restart the machine, close the session, shutdown the machine. Do you think that is possible do that? Please I need help with this, I'm desperate. |
Administrator
|
First, which version of KDE are you using? I'll assume KDE 4.x for the following.
You can detect the presence of a KDE session by "ksmserver" running, or "org.kde.ksmserver" being present on the session bus ( it can be accessed using QtDBus if using Qt ). You can communicate with KSMServer ( KDE Session Management Server ) to logout, shutdown, etc. the session. Documentation to those arguments can be found at api.kde.org. Not sure how you can get a list of processes, I suggest looking at the code of KSysGuard, which is located in kdebase in KDE SVN.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
the application is being written with QT3.3.8 on KDE 3.5, and I'm searching about KDGUS, to see what I get. I can say about it.
|
Administrator
|
In this case, you need to look into DCOP, which will be provided by kdelibs in KDE 3. The same calls are still made to KSMServer though I believe.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
You are right? right now i'm looking for DCOP documentation and reading, but for now I'm using the pipe in the file stream, I do not know is this the right term, by with the popen() function i'm create a file for execute the command that i need for example
file * fileDescritor = popen("users", "r"); this return a list with the users that get log in. But now I have an other question, is possible to execute a program that runs in a kde desktop from a daemon, or how can I create a daemon for KDE. |
Administrator
|
If you can access the dcopserver for a users session ( you need to have DISPLAY set appropriately then run the command under their username I think ) then you can send a message to klauncher to have a command run.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient