diff options
author | Ken Moore <ken@ixsystems.com> | 2018-06-07 20:55:48 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-06-07 20:55:48 -0400 |
commit | e92b681e3c10ff4845dafccfd56971db33b11795 (patch) | |
tree | fc3d43f659756639b4b20391eb3b3370018c9786 /src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp | |
parent | Get more of the tray icon reading put together. (diff) | |
download | lumina-e92b681e3c10ff4845dafccfd56971db33b11795.tar.gz lumina-e92b681e3c10ff4845dafccfd56971db33b11795.tar.bz2 lumina-e92b681e3c10ff4845dafccfd56971db33b11795.zip |
Remove the xscreensaver return code check, apparently it is now erratic regarding whether it returns 0 or 1 - even if it succeeds both times. Go ahead and assume success for any xscreensaver call.
Diffstat (limited to 'src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp')
-rw-r--r-- | src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp index 11c0d468..c6149648 100644 --- a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp @@ -124,22 +124,28 @@ void LOS::setScreenBrightness(int percent){ qDebug() << "Set hardware brightness:" << percent << success; }*/ if( !success && LUtils::isValidBinary("intel_backlight") && !remoteSession){ + //qDebug() << "Run intel_backlight"; //Use the intel_backlight utility (only for Intel mobo/hardware?) - if(0== LUtils::runCmd("intel_backlight", QStringList() <<QString::number(percent)) ){ - //This utility does not report success/failure - run it again to get the current value and ensure it was set properly - success = (percent == LUtils::getCmdOutput("intel_backlight").join("").section("%",0,0).section(":",1,1).simplified().toInt() ); - } + // Note: this returns an integer value corresponding to the percent brightess the screen was just set to + int ret = LUtils::runCmd("sudo -n intel_backlight", QStringList() << QString::number(percent)); + //qDebug() << " - Return value:" << ret; + success = (percent == ret); } // - if hardware brightness does not work, use software brightness if(!success && LUtils::isValidBinary("xbrightness") ){ + //qDebug() << "Run xbrightness"; QString cmd = "xbrightness %1"; float pf = percent/100.0; //convert to a decimel cmd = cmd.arg( QString::number( int(65535*pf) ) ); - success = (0 == LUtils::runCmd(cmd) ); + LUtils::runCmd(cmd); + //qDebug() << " - Return value:" << ret; + success = true; } //Save the result for later + //qDebug() << "Got Brightness:" << percent << success; if(!success){ screenbrightness = -1; } else{ screenbrightness = percent; } + //qDebug() << " - Write to file:" << screenbrightness; LUtils::writeFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/.currentxbrightness", QStringList() << QString::number(screenbrightness), true); } |