diff options
author | Christopher Roy Bratusek <nano@jpberlin.de> | 2015-04-23 20:21:10 +0200 |
---|---|---|
committer | Christopher Roy Bratusek <nano@jpberlin.de> | 2015-04-23 20:21:10 +0200 |
commit | 73879413e0b9b232a0db60f07f9a4d72ca18fdd0 (patch) | |
tree | 29b287e8b3644c1f8aaa2438f0dbd59b5d0c9eef | |
parent | Re-arrange the startup procedures a bit: (diff) | |
download | lumina-73879413e0b9b232a0db60f07f9a4d72ca18fdd0.tar.gz lumina-73879413e0b9b232a0db60f07f9a4d72ca18fdd0.tar.bz2 lumina-73879413e0b9b232a0db60f07f9a4d72ca18fdd0.zip |
shutdown/reboot/suspend via systemd on Debian
-rw-r--r-- | libLumina/LuminaOS-Debian.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/libLumina/LuminaOS-Debian.cpp b/libLumina/LuminaOS-Debian.cpp index a7be653c..650a2b5a 100644 --- a/libLumina/LuminaOS-Debian.cpp +++ b/libLumina/LuminaOS-Debian.cpp @@ -100,7 +100,6 @@ QString info = LUtils::getCmdOutput("amixer get Master").join("").simplified();; } return out; - } //Set the current volume @@ -139,27 +138,37 @@ void LOS::startMixerUtility(){ //Check for user system permission (shutdown/restart) bool LOS::userHasShutdownAccess(){ - return true; //not implemented yet + QProcess::startDetached("dbus-send --system --print-reply=literal \ + --type=method_call --dest=org.freedesktop.login1 \ + /org/freedesktop/login1 org.freedesktop.login1.Manager.CanPowerOff"); } //System Shutdown void LOS::systemShutdown(){ //start poweroff sequence - QProcess::startDetached("shutdown -h now"); + QProcess::startDetached("dbus-send --system --print-reply \ + --dest=org.freedesktop.login1 /org/freedesktop/login1 \ + org.freedesktop.login1.Manager.PowerOff boolean:true"); } //System Restart void LOS::systemRestart(){ //start reboot sequence - QProcess::startDetached("shutdown -r now"); + QProcess::startDetached("dbus-send --system --print-reply \ + --dest=org.freedesktop.login1 /org/freedesktop/login1 \ + org.freedesktop.login1.Manager.Reboot boolean:true"); } //Check for suspend support bool LOS::systemCanSuspend(){ - return false; + QProcess::startDetached("dbus-send --system --print-reply=literal \ + --type=method_call --dest=org.freedesktop.login1 \ + /org/freedesktop/login1 org.freedesktop.login1.Manager.CanSuspend"); } //Put the system into the suspend state void LOS::systemSuspend(){ - + QProcess::startDetached("dbus-send --system --print-reply \ + --dest=org.freedesktop.login1 /org/freedesktop/login1 \ + org.freedesktop.login1.Manager.Suspend boolean:true"); } //Battery Availability |