1 //===========================================
2 // Lumina-desktop source code
3 // Copyright (c) 2012-2017, Ken Moore
4 // Available under the 3-clause BSD license
5 // See the LICENSE file for full details
6 //===========================================
7
8 #include "global-includes.h"
9 #include "LSession.h"
10
11 #define DEBUG 0
12
main(int argc,char ** argv)13 int main(int argc, char ** argv)
14 {
15 qDebug() << "Starting lumina-desktop-unified...";
16 if (argc > 1) {
17 if (QString(argv[1]) == QString("--version")){
18 qDebug() << LDesktopUtils::LuminaDesktopVersion();
19 return 0;
20 }
21 }
22 if(!QFile::exists(LOS::LuminaShare())){
23 qDebug() << "Lumina does not appear to be installed correctly. Cannot find: " << LOS::LuminaShare();
24 return 1;
25 }
26 //Setup any pre-QApplication initialization values
27 LTHEME::LoadCustomEnvSettings();
28 LXDG::setEnvironmentVars();
29 setenv("DESKTOP_SESSION","Lumina",1);
30 setenv("XDG_CURRENT_DESKTOP","Lumina",1);
31 setenv("QT_NO_GLIB", "1", 1); //Disable the glib event loop within Qt at runtime (performance hit + bugs)
32 setenv("QT_QPA_PLATFORMTHEME", "lthemeengine",1); //causes issues with Lumina themes - not many people have this by default...
33 unsetenv("QT_AUTO_SCREEN_SCALE_FACTOR"); //need exact-pixel measurements (no fake scaling)
34
35 //Startup the session
36 if(DEBUG){ qDebug() << "Starting unified session"; }
37 LSession a(argc, argv);
38 if(!a.isPrimaryProcess()){ return 0; }
39 QTime *timer=0;
40 if(DEBUG){ timer = new QTime(); timer->start(); }
41 if(DEBUG){ qDebug() << "Theme Init:" << timer->elapsed(); }
42 /*LuminaThemeEngine theme(&a);
43 QObject::connect(&theme, SIGNAL(updateIcons()), &a, SLOT(reloadIconTheme()) );*/
44 if(DEBUG){ qDebug() << "Session Setup:" << timer->elapsed(); }
45 QTimer::singleShot(0, &a, SLOT(setupSession()) );
46 //theme.refresh();
47 if(DEBUG){ qDebug() << "Exec Time:" << timer->elapsed(); delete timer;}
48 int retCode = a.exec();
49 qDebug() << "Finished Closing Down Unified Lumina";
50 return retCode;
51 }
52