aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
-rw-r--r--src-qt5/core/lumina-desktop-unified/LSession.cpp45
-rw-r--r--src-qt5/core/lumina-desktop-unified/LSession.h4
-rw-r--r--src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf4
-rw-r--r--src-qt5/core/lumina-desktop-unified/global-includes.h1
-rw-r--r--src-qt5/core/lumina-desktop-unified/lumina-desktop.pro1
-rw-r--r--src-qt5/core/lumina-desktop-unified/main.cpp2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h2
7 files changed, 48 insertions, 11 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp
index 0b9a9b35..c6f79584 100644
--- a/src-qt5/core/lumina-desktop-unified/LSession.cpp
+++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp
@@ -18,8 +18,6 @@
NativeWindowSystem* Lumina::NWS = 0;
NativeEventFilter* Lumina::NEF = 0;
LScreenSaver* Lumina::SS = 0;
-//DesktopSettings* Lumina::SETTINGS = 0;
-//Lumina::WM = 0;
QThread* Lumina::EVThread = 0;
RootWindow* Lumina::ROOTWIN = 0;
XDGDesktopList* Lumina::APPLIST = 0;
@@ -49,7 +47,6 @@ LSession::LSession(int &argc, char ** argv) : LSingleApplication(argc, argv, "lu
//Now initialize the global objects (but do not start them yet)
Lumina::NEF = new NativeEventFilter();
Lumina::NWS = new NativeWindowSystem();
- //Lumina::SETTINGS = new DesktopSettings();
Lumina::SS = new LScreenSaver();
//Now put the Native Window System into it's own thread to keep things snappy
Lumina::EVThread = new QThread();
@@ -67,7 +64,6 @@ LSession::~LSession(){
//Clean up the global objects as needed
if(Lumina::NEF!=0){ Lumina::NEF->deleteLater(); }
if(Lumina::NWS!=0){ Lumina::NWS->deleteLater(); }
- //if(Lumina::EFILTER!=0){ Lumina::EFILTER->deleteLater(); }
if(Lumina::SS!=0){ Lumina::SS->deleteLater(); }
if(Lumina::EVThread!=0){
if(Lumina::EVThread->isRunning()){ Lumina::EVThread->quit(); }
@@ -385,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/main.cpp b/src-qt5/core/lumina-desktop-unified/main.cpp
index 0b67de46..8e40f7eb 100644
--- a/src-qt5/core/lumina-desktop-unified/main.cpp
+++ b/src-qt5/core/lumina-desktop-unified/main.cpp
@@ -30,6 +30,8 @@ int main(int argc, char ** argv)
setenv("XDG_CURRENT_DESKTOP","Lumina",1);
setenv("QT_NO_GLIB", "1", 1); //Disable the glib event loop within Qt at runtime (performance hit + bugs)
unsetenv("QT_QPA_PLATFORMTHEME"); //causes issues with Lumina themes - not many people have this by default...
+ unsetenv("QT_AUTO_SCREEN_SCALE_FACTOR"); //need exact-pixel measurements (no fake scaling)
+
//Startup the session
if(DEBUG){ qDebug() << "Starting unified session"; }
LSession a(argc, argv);
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
bgstack15