aboutsummaryrefslogtreecommitdiff
path: root/libLumina
diff options
context:
space:
mode:
authorwi <william.os4y@gmail.com>2015-04-17 14:22:53 +0200
committerwi <william.os4y@gmail.com>2015-04-17 14:22:53 +0200
commitd231558a8be5dea107a2031fb39b9c18ca8b863d (patch)
treeb13752f01be68969208c41acd0ac5a8d7cd0dc43 /libLumina
parentMerge remote-tracking branch 'upstream/master' into deskEditor (diff)
parentUpdate the system dashboard behavior a bit: (diff)
downloadlumina-d231558a8be5dea107a2031fb39b9c18ca8b863d.tar.gz
lumina-d231558a8be5dea107a2031fb39b9c18ca8b863d.tar.bz2
lumina-d231558a8be5dea107a2031fb39b9c18ca8b863d.zip
Merge remote-tracking branch 'upstream/master' into deskEditor
Diffstat (limited to 'libLumina')
-rw-r--r--libLumina/LuminaOS-FreeBSD.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp
index fc4135f0..73637048 100644
--- a/libLumina/LuminaOS-FreeBSD.cpp
+++ b/libLumina/LuminaOS-FreeBSD.cpp
@@ -72,12 +72,21 @@ void LOS::setScreenBrightness(int percent){
if(percent<0){percent=0;}
else if(percent>100){ percent=100; }
float pf = percent/100.0; //convert to a decimel
- //Run the command
- QString cmd = "xbrightness %1";
- cmd = cmd.arg( QString::number( int(65535*pf) ) );
- int ret = LUtils::runCmd(cmd);
+ //Run the command(s)
+ bool success = false;
+ // - try hardware setting first (PC-BSD only)
+ if(QFile::exists("/usr/local/bin/pc-sysconfig")){
+ QString ret = LUtils::getCmdOutput("pc-sysconfig \"setscreenbrightness "+QString::number(percent)+"\"").join("");
+ success = (ret.simplified() == "[SUCCESS]");
+ }
+ // - if hardware brightness does not work, use software brightness
+ if(!success){
+ QString cmd = "xbrightness %1";
+ cmd = cmd.arg( QString::number( int(65535*pf) ) );
+ success = (0 == LUtils::runCmd(cmd) );
+ }
//Save the result for later
- if(ret!=0){ screenbrightness = -1; }
+ if(!success){ screenbrightness = -1; }
else{ screenbrightness = percent; }
LUtils::writeFile(QDir::homePath()+"/.lumina/.currentxbrightness", QStringList() << QString::number(screenbrightness), true);
}
bgstack15