aboutsummaryrefslogtreecommitdiff
path: root/libLumina/LuminaOS-FreeBSD.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-04-16 22:49:58 -0400
committerKen Moore <ken@pcbsd.org>2015-04-16 22:49:58 -0400
commitaeba6cb5554186478d15cbfc7a9ac580d3c52c72 (patch)
tree9baa36ce1136bba09ca0709a843060d2db686ec6 /libLumina/LuminaOS-FreeBSD.cpp
parentClean up a *lot* of the general XCB warnings that sometimes occur, and also t... (diff)
downloadlumina-aeba6cb5554186478d15cbfc7a9ac580d3c52c72.tar.gz
lumina-aeba6cb5554186478d15cbfc7a9ac580d3c52c72.tar.bz2
lumina-aeba6cb5554186478d15cbfc7a9ac580d3c52c72.zip
Fix the session chimes (and possible stability issue) by removing the special audio thread and using the QMediaPlayer within the main thread (no stuttering/delays in my initial tests so far).
Add a PC-BSD specific routine for setting brightness so that hardware brightness controls are attempted (through pc-sysconfig) before the software brightness is modified (using xbrightness)
Diffstat (limited to 'libLumina/LuminaOS-FreeBSD.cpp')
-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