diff options
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
6 files changed, 46 insertions, 7 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp index 60ed1a39..c6f79584 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.cpp +++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp @@ -381,11 +381,46 @@ void LSession::StartReboot(bool skipupdates){ QCoreApplication::exit(0); } -void LSession::LaunchApplication(QString app){ - +void LSession::LaunchApplication(QString exec){ + ExternalProcess::launch(exec); } -void LSession::LaunchStandardApplication(QString app){ +void LSession::LaunchStandardApplication(QString app, QStringList args){ + //Find/replace standardized apps with thier mimetypes + if(app.startsWith("--")){ app = "application/"+app.section("--",-1).simplified(); } + //First see if this is a mimetype with a default application + if(app.count("/")==1 && !app.startsWith("/")){ + QString mimeapp = XDGMime::findDefaultAppForMime(app); + if(!mimeapp.isEmpty()){ app = mimeapp; } + } + if(app.endsWith(".desktop")){ + //Get the XDGDesktop structure + XDGDesktop *desk = 0; bool cleanup = false; + if(app.startsWith("/") && QFile::exists(app)){ desk = new XDGDesktop(app); cleanup = true; } + if(!desk->isValid()){ + //Need to find the app within the current list + QHash<QString, XDGDesktop*>applist = Lumina::APPLIST->files; + if(cleanup){ desk->deleteLater(); desk = 0; cleanup = false; } + app = app.section("/",-1); //make sure this is a relative path + QStringList list = applist.keys().filter("/"+app); + if(!list.filter(QDir::homePath()).isEmpty()){ desk = applist[list.filter(QDir::homePath()).first()]; } //prefer user-override files + if(desk==0 || !desk->isValid()){ + desk = 0; + for(int i=0; i<list.length() && desk==0; i++){ + XDGDesktop *tmp = applist[list[i]]; + if(tmp->isValid()){ desk = tmp; } + } + } + } + if(desk!=0 && desk->isValid()){ + //Got the application - go ahead and assemble the startup command + QString exec = desk->generateExec(args); //args are embedded into the exec command as needed + ExternalProcess::launch(exec, QStringList(), desk->startupNotify); + } + if(cleanup){ desk->deleteLater(); } + }else{ + ExternalProcess::launch(app, args, false); // do not use startup notify cursor + } } diff --git a/src-qt5/core/lumina-desktop-unified/LSession.h b/src-qt5/core/lumina-desktop-unified/LSession.h index 0d666bfa..85cc050c 100644 --- a/src-qt5/core/lumina-desktop-unified/LSession.h +++ b/src-qt5/core/lumina-desktop-unified/LSession.h @@ -32,8 +32,8 @@ public slots: void StartLogout(); void StartShutdown(bool skipupdates = false); void StartReboot(bool skipupdates = false); - void LaunchApplication(QString app); - void LaunchStandardApplication(QString app); + void LaunchApplication(QString exec); + void LaunchStandardApplication(QString app, QStringList args = QStringList()); void reloadIconTheme(); //will emit the IconThemeChanged signal when ready void switchLocale(QString localeCode); //will emit the LocaleChanged signal when ready diff --git a/src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf b/src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf index c1417b85..59959194 100644 --- a/src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf +++ b/src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf @@ -4,5 +4,5 @@ Pause=Lockscreen Alt+L=Lockscreen [desktop] -Alt+F1=Launch: terminal -Print=Launch: screenshot +Alt+F1=Launch: --terminal +Print=Launch: --screenshot diff --git a/src-qt5/core/lumina-desktop-unified/global-includes.h b/src-qt5/core/lumina-desktop-unified/global-includes.h index 1d0ab068..92f895c2 100644 --- a/src-qt5/core/lumina-desktop-unified/global-includes.h +++ b/src-qt5/core/lumina-desktop-unified/global-includes.h @@ -62,6 +62,7 @@ #include <NativeWindow.h> #include <NativeWindowSystem.h> #include <NativeEventFilter.h> +#include <XDGMime.h> // Standard C includes #include <unistd.h> diff --git a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro index defa66f4..79f2ba6f 100644 --- a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro @@ -19,6 +19,7 @@ include(../libLumina/DesktopSettings.pri) include(../libLumina/RootWindow.pri) include(../libLumina/ExternalProcess.pri) include(../libLumina/NativeWindow.pri) +include(../libLumina/XDGMime.pri) #include all the main individual source groups include(src-screensaver/screensaver.pri) diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h index 1e3165ec..7fd21967 100644 --- a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h +++ b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h @@ -32,6 +32,8 @@ private slots: signals: void LockSession(); void showLeaveDialog(); + void LaunchStandardApplication(QString); + void LaunchApplication(QString); }; #endif |