Permalink
Browse files

Add the "PCDM_SESSION" environment variable to the user's desktop ses…

…sion with the value being the (all uppercase) non-localized name of the DE that was started.
  • Loading branch information...
1 parent efd1e98 commit 9a6b8ef252c78ed6b2cfda6d491399e561a56b68 @beanpole135 beanpole135 committed Jan 13, 2014
Showing with 14 additions and 2 deletions.
  1. +12 −2 src-qt4/PCDM/src/pcdm-backend.cpp
  2. +1 −0 src-qt4/PCDM/src/pcdm-backend.h
  3. +1 −0 src-qt4/PCDM/src/pcdm-xprocess.cpp
View
14 src-qt4/PCDM/src/pcdm-backend.cpp
@@ -11,7 +11,7 @@
#include "pcdm-config.h"
#include "pcbsd-utils.h"
-QStringList displaynameList,usernameList,homedirList,usershellList,instXNameList,instXBinList,instXCommentList,instXIconList;
+QStringList displaynameList,usernameList,homedirList,usershellList,instXNameList,instXBinList,instXCommentList,instXIconList,instXDEList;
QString logFile;
QString saveX,saveUsername, lastUser, lastDE;
@@ -28,6 +28,14 @@ QString Backend::getDesktopComment(QString xName){
return instXCommentList[index];
}
+QString Backend::getNLDesktopName(QString xName){
+ //Get the non-localized desktop name from the localized version
+ if(instXNameList.isEmpty()){ loadXSessionsData(); }
+ int index = instXNameList.indexOf(xName);
+ if(index == -1){ Backend::log("PCDM: Invalid Desktop Name: " +xName); return ""; }
+ return instXDEList[index];
+}
+
QString Backend::getDesktopIcon(QString xName){
if(instXNameList.isEmpty()){ loadXSessionsData(); }
int index = instXNameList.indexOf(xName);
@@ -314,6 +322,7 @@ void Backend::loadXSessionsData(){
//Clear the current variables
instXNameList.clear(); instXBinList.clear();
instXCommentList.clear(); instXIconList.clear();
+ instXDEList.clear();
//Load the default paths/locale
QString xDir = Config::xSessionsDir();
QStringList paths = QString(getenv("PATH")).split(":");
@@ -348,6 +357,7 @@ void Backend::loadXSessionsData(){
instXBinList << tmp[0];
instXNameList << tmp[1];
instXCommentList << tmp[2];
+ instXDEList << tmp[5]; //Non-localized name of the DE
//Check to make sure we have a valid icon
if(!tmp[3].isEmpty() && !QFile::exists(tmp[3]) ){ tmp[3] = ""; }
instXIconList << tmp[3];
@@ -405,7 +415,7 @@ QStringList Backend::readXSessionsFile(QString filePath, QString locale){
}
//Format the results into the output list
output.clear();
- output << exec << lname << lcomm << icon << tryexec;
+ output << exec << lname << lcomm << icon << tryexec << name;
return output;
}
View
1 src-qt4/PCDM/src/pcdm-backend.h
@@ -31,6 +31,7 @@ class Backend {
public:
static QStringList getAvailableDesktops();
static QString getDesktopComment(QString);
+ static QString getNLDesktopName(QString);
static QString getDesktopIcon(QString);
static QString getDesktopBinary(QString);
static QStringList getSystemUsers();
View
1 src-qt4/PCDM/src/pcdm-xprocess.cpp
@@ -180,6 +180,7 @@ void XProcess::setupSessionEnvironment(){
environ.insert("SHLVL","0"); //Set the proper shell level
environ.insert("HOME",xhome); //Set the users home directory
environ.insert("SHELL",xshell); //Set the user's default shell
+ environ.insert("PCDM_SESSION", Backend::getNLDesktopName(xde).toUpper() ); //List the desktop environment that is being started
this->setProcessEnvironment(environ);
this->setWorkingDirectory(xhome); //set the current directory to the user's home directory
}

0 comments on commit 9a6b8ef

Please sign in to comment.