aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core')
-rw-r--r--src-qt5/core/libLumina/LuminaUtils.cpp29
-rw-r--r--src-qt5/core/libLumina/LuminaUtils.h5
-rw-r--r--src-qt5/core/lumina-desktop/AppMenu.cpp2
-rw-r--r--src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf2
4 files changed, 33 insertions, 5 deletions
diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp
index 12dcf0be..5340d223 100644
--- a/src-qt5/core/libLumina/LuminaUtils.cpp
+++ b/src-qt5/core/libLumina/LuminaUtils.cpp
@@ -211,6 +211,23 @@ QString LUtils::PathToAbsolute(QString path){
}
return path;
}
+QString LUtils::AppToAbsolute(QString path){
+ if(path.startsWith("/") || QFile::exists(path)){ return path; }
+ if(path.endsWith(".desktop")){
+ //Look in the XDG dirs
+ QStringList dirs = LXDG::systemApplicationDirs();
+ for(int i=0; i<dirs.length(); i++){
+ if(QFile::exists(dirs[i]+"/"+path)){ return (dirs[i]+"/"+path); }
+ }
+ }else{
+ //Look on $PATH for the binary
+ QStringList paths = QString(getenv("PATH")).split(":");
+ for(int i=0; i<paths.length(); i++){
+ if(QFile::exists(paths[i]+"/"+path)){ return (paths[i]+"/"+path); }
+ }
+ }
+ return path;
+}
QStringList LUtils::imageExtensions(bool wildcards){
//Note that all the image extensions are lowercase!!
@@ -593,12 +610,14 @@ void LUtils::LoadSystemDefaults(bool skipOS){
if(var.contains(".")){ var.replace(".","_"); }
//Now parse the variable and put the value in the proper file
+ if(var.contains("_default_")){ val = AppToAbsolute(val); } //got an application/binary
//Special handling for values which need to exist first
if(var.endsWith("_ifexists") ){
var = var.remove("_ifexists"); //remove this flag from the variable
//Check if the value exists (absolute path only)
if(!QFile::exists(val)){ continue; } //skip this line - value/file does not exist
}
+
//Parse/save the value
QString loset, sset; //temporary strings
if(var=="session_enablenumlock"){ sset = "EnableNumlock="+ istrue; }
@@ -606,11 +625,16 @@ void LUtils::LoadSystemDefaults(bool skipOS){
else if(var=="session_playlogoutaudio"){ sset = "PlayLogoutAudio="+istrue; }
else if(var=="session_default_terminal"){ sset = "default-terminal="+val; }
else if(var=="session_default_filemanager"){
+ LXDG::setDefaultAppForMime("inode/directory", val);
sset = "default-filemanager="+val;
loset = "directory="+val;
+ }else if(var=="session_default_webbrowser"){
+ loset = "webbrowser="+val;
+ LXDG::setDefaultAppForMime("x-scheme-handler/http", val);
+ LXDG::setDefaultAppForMime("x-scheme-handler/https", val);
+ }else if(var=="session_default_email"){
+ loset = "email="+val;
}
- else if(var=="session_default_webbrowser"){ loset = "webbrowser="+val; }
- else if(var=="session_default_email"){ loset = "email="+val; }
//Put the line into the file (overwriting any previous assignment as necessary)
if(!loset.isEmpty()){
int index = lopenset.indexOf(QRegExp(loset.section("=",0,0)+"=*", Qt::CaseSensitive, QRegExp::Wildcard));
@@ -710,6 +734,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){
if(var.contains(".")){ var.replace(".","_"); }
//Now parse the variable and put the value in the proper file
qDebug() << "Favorite entry:" << var << val;
+ val = AppToAbsolute(val); //turn any relative files into absolute
if(var=="favorites_add_ifexists" && QFile::exists(val)){ qDebug() << " - Exists/Adding:"; LUtils::addFavorite(val); }
else if(var=="favorites_add"){ qDebug() << " - Adding:"; LUtils::addFavorite(val); }
else if(var=="favorites_remove"){ qDebug() << " - Removing:"; LUtils::removeFavorite(val); }
diff --git a/src-qt5/core/libLumina/LuminaUtils.h b/src-qt5/core/libLumina/LuminaUtils.h
index 32109244..e07363ca 100644
--- a/src-qt5/core/libLumina/LuminaUtils.h
+++ b/src-qt5/core/libLumina/LuminaUtils.h
@@ -54,8 +54,9 @@ public:
static QStringList listSubDirectories(QString dir, bool recursive = true);
//Convert an input file/dir path to an absolute file path
- static QString PathToAbsolute(QString path);
-
+ static QString PathToAbsolute(QString path); //This is primarily for CLI usage (relative paths)
+ static QString AppToAbsolute(QString path); //This is for looking up a binary/ *.desktop path
+
//Get the list of all file extensions which Qt can read (lowercase)
static QStringList imageExtensions(bool wildcards = false);
diff --git a/src-qt5/core/lumina-desktop/AppMenu.cpp b/src-qt5/core/lumina-desktop/AppMenu.cpp
index 14af988a..0b8aeace 100644
--- a/src-qt5/core/lumina-desktop/AppMenu.cpp
+++ b/src-qt5/core/lumina-desktop/AppMenu.cpp
@@ -32,6 +32,7 @@ QHash<QString, QList<XDGDesktop> >* AppMenu::currentAppHash(){
// PRIVATE
//===========
void AppMenu::updateAppList(){
+ watcher->removePaths(watcher->directories());
//Make sure the title/icon are updated as well (in case of locale/icon change)
this->setTitle(tr("Applications"));
this->setIcon( LXDG::findIcon("system-run","") );
@@ -111,6 +112,7 @@ void AppMenu::updateAppList(){
}
this->addMenu(menu);
}
+ watcher->addPaths(LXDG::systemApplicationDirs());
emit AppMenuUpdated();
}
diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf
index 41672ab6..f88ad2d0 100644
--- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf
+++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf
@@ -32,7 +32,7 @@ session_default_webbrowser_ifexists=qupzilla.desktop
session_default_email_ifexists=trojita.desktop
#THEME SETTINGS
-#theme.themefile=<file path> #Absolute path to the theme template file to use (disable for Lumina-Default)
+theme_themefile=Glass #Name of the theme to use (disable for Lumina-Default)
theme_colorfile=Black #Name of the color spec file to use for theming
theme_iconset=oxygen #Name of the icon theme to use
theme_font=Arial #Name of the font family to use
bgstack15