aboutsummaryrefslogtreecommitdiff
path: root/libLumina
diff options
context:
space:
mode:
Diffstat (limited to 'libLumina')
-rw-r--r--libLumina/LuminaOS-Debian.cpp21
-rw-r--r--libLumina/LuminaOS-FreeBSD.cpp4
2 files changed, 18 insertions, 7 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
diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp
index 39eae307..7ef782d9 100644
--- a/libLumina/LuminaOS-FreeBSD.cpp
+++ b/libLumina/LuminaOS-FreeBSD.cpp
@@ -22,7 +22,7 @@ QString LOS::SysPrefix(){ return "/usr/"; } //Prefix for system
//OS-specific application shortcuts (*.desktop files)
QString LOS::ControlPanelShortcut(){ return "/usr/local/share/applications/pccontrol.desktop"; } //system control panel
QString LOS::AppStoreShortcut(){ return "/usr/local/share/applications/softmanager.desktop"; } //graphical app/pkg manager
-QString LOS::QtConfigShortcut(){ return "/usr/local/bin/qtconfig-qt4"; } //qtconfig binary (NOT *.desktop file)
+QString LOS::QtConfigShortcut(){ return ""; } //qtconfig binary (NOT *.desktop file)
// ==== ExternalDevicePaths() ====
QStringList LOS::ExternalDevicePaths(){
@@ -58,6 +58,7 @@ int LOS::ScreenBrightness(){
//Make sure we are not running in VirtualBox (does not work in a VM)
QStringList info = LUtils::getCmdOutput("pciconf -lv");
if( !info.filter("VirtualBox", Qt::CaseInsensitive).isEmpty() ){ return -1; }
+ else if( !LUtils::isValidBinary("xbrightness") ){ return -1; } //incomplete install
//Now perform the standard brightness checks
if(screenbrightness==-1){ //memory value
if(QFile::exists(QDir::homePath()+"/.lumina/.currentxbrightness")){ //saved file value
@@ -70,6 +71,7 @@ int LOS::ScreenBrightness(){
//Set screen brightness
void LOS::setScreenBrightness(int percent){
+ if(percent == -1){ return; } //This is usually an invalid value passed directly to the setter
//ensure bounds
if(percent<0){percent=0;}
else if(percent>100){ percent=100; }
bgstack15