aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2016-10-25 11:54:57 -0400
committerKen Moore <ken@ixsystems.com>2016-10-25 11:54:57 -0400
commitaf6ce6ea4f6b62d0b09b0b9ae2f8d640e828802a (patch)
tree9e79849d9fd6d013e53e3b43ee7726f1e29e5c6e /src-qt5
parentFix the creation of new files/directories within the right-column of a split ... (diff)
downloadlumina-af6ce6ea4f6b62d0b09b0b9ae2f8d640e828802a.tar.gz
lumina-af6ce6ea4f6b62d0b09b0b9ae2f8d640e828802a.tar.bz2
lumina-af6ce6ea4f6b62d0b09b0b9ae2f8d640e828802a.zip
Add PulseAudio support into the FreeBSD backend if a PICO session is detected.
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp77
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.cpp1
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.h3
3 files changed, 51 insertions, 30 deletions
diff --git a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp
index 2bffb5a1..b9346565 100644
--- a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp
+++ b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp
@@ -97,13 +97,14 @@ void LOS::setScreenBrightness(int percent){
//Run the command(s)
bool success = false;
// - try hardware setting first (TrueOS || or intel_backlight)
- if( LUtils::isValidBinary("pc-sysconfig") ){
+ bool remoteSession = !QString(getenv("PICO_CLIENT_LOGIN")).isEmpty();
+ if( LUtils::isValidBinary("pc-sysconfig") && !remoteSession){
//Use TrueOS tool (direct sysctl control)
QString ret = LUtils::getCmdOutput("pc-sysconfig", QStringList() <<"setscreenbrightness "+QString::number(percent)).join("");
success = ret.toLower().contains("success");
qDebug() << "Set hardware brightness:" << percent << success;
}
- if( !success && LUtils::isValidBinary("intel_backlight")){
+ if( !success && LUtils::isValidBinary("intel_backlight") && !remoteSession){
//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
@@ -131,11 +132,17 @@ int LOS::audioVolume(){ //Returns: audio volume as a percentage (0-100, with -1
QString info = LUtils::readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/.currentvolume").join("");
if(!info.isEmpty()){
out = info.simplified().toInt();
- audiovolume = out; //unset this internal flag
+ audiovolume = out; //reset this internal flag
return out;
}
}
-
+ bool remoteSession = !QString(getenv("PICO_CLIENT_LOGIN")).isEmpty();
+ if(remoteSession){
+ QStringList info = LUtils::getCmdOutput("pactl list short sinks");
+ qDebug() << "Got PA sinks:" << info;
+ out = 50; //TEMPORARY - still need to write up the info parsing
+ audiovolume = out;
+ }else{
//probe the system for the current volume (other utils could be changing it)
QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
if(!info.isEmpty()){
@@ -149,7 +156,7 @@ int LOS::audioVolume(){ //Returns: audio volume as a percentage (0-100, with -1
}
audiovolume = out;
}
-
+ }
return out;
}
@@ -157,35 +164,45 @@ int LOS::audioVolume(){ //Returns: audio volume as a percentage (0-100, with -1
void LOS::setAudioVolume(int percent){
if(percent<0){percent=0;}
else if(percent>100){percent=100;}
- QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
- if(!info.isEmpty()){
- int L = info.section(":",1,1).toInt();
- int R = info.section(":",2,2).toInt();
- int diff = L-R;
- if((percent == L) && (L==R)){ return; } //already set to that volume
- if(diff<0){ R=percent; L=percent+diff; } //R Greater
- else{ L=percent; R=percent-diff; } //L Greater or equal
- //Check bounds
- if(L<0){L=0;}else if(L>100){L=100;}
- if(R<0){R=0;}else if(R>100){R=100;}
- //Run Command
- audiovolume = percent; //save for checking later
- LUtils::runCmd("mixer vol "+QString::number(L)+":"+QString::number(R));
- LUtils::writeFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/.currentvolume", QStringList() << QString::number(percent), true);
- }
+ bool remoteSession = !QString(getenv("PICO_CLIENT_LOGIN")).isEmpty();
+ if(remoteSession){
+ LUtils::runCmd(QString("pactl set-sink-volume @DEFAULT_SINK@ ")+QString::number(percent)+"%");
+ }else{
+ QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
+ if(!info.isEmpty()){
+ int L = info.section(":",1,1).toInt();
+ int R = info.section(":",2,2).toInt();
+ int diff = L-R;
+ if((percent == L) && (L==R)){ return; } //already set to that volume
+ if(diff<0){ R=percent; L=percent+diff; } //R Greater
+ else{ L=percent; R=percent-diff; } //L Greater or equal
+ //Check bounds
+ if(L<0){L=0;}else if(L>100){L=100;}
+ if(R<0){R=0;}else if(R>100){R=100;}
+ //Run Command
+ LUtils::runCmd("mixer vol "+QString::number(L)+":"+QString::number(R));
+ }
+ }
+ audiovolume = percent; //save for checking later
+ LUtils::writeFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/.currentvolume", QStringList() << QString::number(percent), true);
}
//Change the current volume a set amount (+ or -)
void LOS::changeAudioVolume(int percentdiff){
- QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
- if(!info.isEmpty()){
- int L = info.section(":",1,1).toInt() + percentdiff;
- int R = info.section(":",2,2).toInt() + percentdiff;
- //Check bounds
- if(L<0){L=0;}else if(L>100){L=100;}
- if(R<0){R=0;}else if(R>100){R=100;}
- //Run Command
- LUtils::runCmd("mixer vol "+QString::number(L)+":"+QString::number(R));
+ bool remoteSession = !QString(getenv("PICO_CLIENT_LOGIN")).isEmpty();
+ if(remoteSession){
+ LUtils::runCmd(QString("pactl set-sink-volume @DEFAULT_SINK@ ")+((percentdiff>0)?"+" : "") + QString::number(percentdiff)+"%");
+ }else{
+ QString info = LUtils::getCmdOutput("mixer -S vol").join(":").simplified(); //ignores any other lines
+ if(!info.isEmpty()){
+ int L = info.section(":",1,1).toInt() + percentdiff;
+ int R = info.section(":",2,2).toInt() + percentdiff;
+ //Check bounds
+ if(L<0){L=0;}else if(L>100){L=100;}
+ if(R<0){R=0;}else if(R>100){R=100;}
+ //Run Command
+ LUtils::runCmd("mixer vol "+QString::number(L)+":"+QString::number(R));
+ }
}
}
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp
index 8ae77ea6..b0d2edd9 100644
--- a/src-qt5/core/libLumina/LuminaXDG.cpp
+++ b/src-qt5/core/libLumina/LuminaXDG.cpp
@@ -22,6 +22,7 @@ XDGDesktop::XDGDesktop(QString file, QObject *parent) : QObject(parent){
isHidden=false;
useTerminal=false;
startupNotify=false;
+ useVGL = false;
type = XDGDesktop::BAD;
filePath = file;
exec = tryexec = ""; // just to make sure this is initialized
diff --git a/src-qt5/core/libLumina/LuminaXDG.h b/src-qt5/core/libLumina/LuminaXDG.h
index acb688ff..1c86cedb 100644
--- a/src-qt5/core/libLumina/LuminaXDG.h
+++ b/src-qt5/core/libLumina/LuminaXDG.h
@@ -64,6 +64,9 @@ public:
QStringList actionList, mimeList, catList, keyList;
bool useTerminal, startupNotify;
QList<XDGDesktopAction> actions;
+ //Type 1 Extensions for Lumina (Optional)
+ bool useVGL; //X-VGL
+
//Type 2 (LINK) variables
QString url;
bgstack15