|
8 | 8 | #include <QScreen> |
9 | 9 | #include <string> |
10 | 10 | #include <iostream> |
| 11 | +#include <unistd.h> |
11 | 12 |
|
12 | 13 | #define FORCE_CRASH_HANDLER |
13 | 14 |
|
@@ -39,23 +40,39 @@ int main(int argc, char *argv[]) |
39 | 40 | airbag_init_fd(fd,crash_handled,EXECUTION_FILENAME); |
40 | 41 | #endif |
41 | 42 |
|
42 | | - |
43 | 43 | QApplication a(argc, argv); |
44 | 44 | QCommandLineParser parser; |
45 | 45 | parser.setApplicationDescription("Graphical User Interface for Viper4Linux2"); |
46 | 46 | parser.addHelpOption(); |
47 | 47 |
|
48 | | - QCommandLineOption tray(QStringList() << "t" << "tray", "Start minimized in systray (forced)"); |
| 48 | + QCommandLineOption tray(QStringList() << "t" << "tray", "Start minimized in systray delayed (forced)"); |
49 | 49 | parser.addOption(tray); |
| 50 | + QCommandLineOption nowtray(QStringList() << "i" << "instant-tray", "Start minimized in systray instantly (forced)"); |
| 51 | + parser.addOption(nowtray); |
50 | 52 | QCommandLineOption sviper(QStringList() << "s" << "startviper", "Start viper on launch"); |
51 | 53 | parser.addOption(sviper); |
52 | 54 | QCommandLineOption minst(QStringList() << "m" << "allow-multiple-instances", "Allow multiple instances of this app"); |
53 | 55 | parser.addOption(minst); |
54 | 56 | parser.process(a); |
55 | | - if(parser.isSet(sviper)) system("viper start"); |
| 57 | + |
| 58 | + if(parser.isSet(sviper)){ |
| 59 | + system("viper start"); |
| 60 | + usleep(300); |
| 61 | + } |
| 62 | + |
| 63 | + if(parser.isSet(tray)){ |
| 64 | + //Delay startup to make sure that the DE is ready |
| 65 | + usleep(1000); |
| 66 | + } |
| 67 | + |
| 68 | + bool startInTray = parser.isSet(tray) || parser.isSet(nowtray); |
56 | 69 |
|
57 | 70 | QApplication::setQuitOnLastWindowClosed( false ); |
58 | | - MainWindow w(QString::fromLocal8Bit(exepath),parser.isSet(tray),parser.isSet(minst)); |
| 71 | + MainWindow w(QString::fromLocal8Bit(exepath), |
| 72 | + startInTray, |
| 73 | + parser.isSet(minst)); |
| 74 | + |
| 75 | + w.setVisible(!startInTray); |
59 | 76 | w.setFixedSize(w.geometry().width(),w.geometry().height()); |
60 | 77 | w.setGeometry( |
61 | 78 | QStyle::alignedRect( |
|
0 commit comments