aboutsummaryrefslogtreecommitdiff
path: root/libLumina
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-01-23 08:00:52 -0500
committerKen Moore <moorekou@gmail.com>2015-01-23 08:00:52 -0500
commite265afb51a6dd36683c8d5d999300945f3083a9c (patch)
treec4f138cb57e29e7598354a7f2f268e2ba1f92fbd /libLumina
parentMerge pull request #40 from ajacoutot/etc-conf (diff)
parentseveral OpenBSD improvements (diff)
downloadlumina-e265afb51a6dd36683c8d5d999300945f3083a9c.tar.gz
lumina-e265afb51a6dd36683c8d5d999300945f3083a9c.tar.bz2
lumina-e265afb51a6dd36683c8d5d999300945f3083a9c.zip
Merge pull request #39 from ajacoutot/openbsd
several OpenBSD improvements
Diffstat (limited to 'libLumina')
-rw-r--r--libLumina/LuminaOS-OpenBSD.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/libLumina/LuminaOS-OpenBSD.cpp b/libLumina/LuminaOS-OpenBSD.cpp
index df6bcda7..a4d3a64b 100644
--- a/libLumina/LuminaOS-OpenBSD.cpp
+++ b/libLumina/LuminaOS-OpenBSD.cpp
@@ -50,6 +50,10 @@ QStringList LOS::ExternalDevicePaths(){
//Read screen brightness information
int LOS::ScreenBrightness(){
//Returns: Screen Brightness as a percentage (0-100, with -1 for errors)
+ //Make sure we are not running in a VM (does not work)
+ QStringList info = LUtils::getCmdOutput("sysctl -n hw.product");
+ if( !info.filter(QRegExp("VirtualBox|KVM")).isEmpty() ){ return -1; }
+ //Now perform the standard brightness checks
if(screenbrightness==-1){
if(QFile::exists(QDir::homePath()+"/.lumina/.currentxbrightness")){
int val = LUtils::readFile(QDir::homePath()+"/.lumina/.currentxbrightness").join("").simplified().toInt();
@@ -144,12 +148,14 @@ void LOS::startMixerUtility(){
//Check for user system permission (shutdown/restart)
bool LOS::userHasShutdownAccess(){
- return true; //not implemented yet
+ //User needs to be a part of the operator group to be able to run the shutdown command
+ QStringList groups = LUtils::getCmdOutput("id -Gn").join(" ").split(" ");
+ return groups.contains("operator");
}
//System Shutdown
void LOS::systemShutdown(){ //start poweroff sequence
- QProcess::startDetached("shutdown -hp now");
+ QProcess::startDetached("shutdown -p now");
}
//System Restart
@@ -159,8 +165,8 @@ void LOS::systemRestart(){ //start reboot sequence
//Battery Availability
bool LOS::hasBattery(){
- int val = LUtils::getCmdOutput("apm -l").join("").toInt();
- return (val >= 0 && val <= 100);
+ int val = LUtils::getCmdOutput("apm -b").join("").toInt();
+ return (val < 4);
}
//Battery Charge Level
bgstack15