Advertisement
Goodevil95

main.cpp

May 28th, 2019
2,168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <QDBusInterface>
  2. #include <QDebug>
  3.  
  4. int main()
  5. {
  6.     QDBusInterface kde("org.kde.ksmserver", "/KSMServer", "org.kde.KSMServerInterface", QDBusConnection::systemBus());
  7.     kde.call("logout", 0, 3, 3);
  8.     qDebug() << "KDE: " << kde.isValid();
  9.  
  10.     QDBusInterface gnome("org.gnome.SessionManager", "/org/gnome/SessionManager", "org.gnome.SessionManager", QDBusConnection::systemBus());
  11.     gnome.call("Logout", 1);
  12.     qDebug() << "Gnome: " << gnome.isValid();
  13.  
  14.     QDBusInterface xfce("org.xfce.SessionManager", "/org/xfce/SessionManager", "org.xfce.Session.Manager", QDBusConnection::systemBus());
  15.     xfce.call("Logout", false, true);
  16.     qDebug() << "XFCE: " << xfce.isValid();
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement