diff options
author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-03-03 18:37:56 +0100 |
---|---|---|
committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-03-03 18:37:56 +0100 |
commit | 2355550bafe44207e7465d0454cb0af0a55dfd8f (patch) | |
tree | 1781f09d3a226895aff90f348496d66d611a6d5a /src/main.cpp | |
parent | f15087cac5ef46ad45350aac2b66f85bd7dd5967 (diff) |
change `--hidden` flag to `--open-at-startup`
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp index 56c20eb..246d0ad 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,3 +1,4 @@ +#include <QtCore/QTimer> #include <QtGui/QCloseEvent> #include <QtWebEngineCore/QWebEngineNotification> #include <QtWebEngineCore/QWebEnginePage> @@ -27,19 +28,19 @@ int main(int argc, char **argv) { QApplication app(argc, argv); - bool start_hidden = false; + bool start_hidden = true; QUrl url; for (auto argument : app.arguments()) { - if (argument == "--hidden") { - start_hidden = true; + if (argument == "--open-at-startup") { + start_hidden = false; } else { url = argument; } } if (url.url().toStdString() == argv[0]) { - std::cerr << "webtray <url> [--hidden]\n"; + std::cerr << "webtray <url> [--open-at-startup]\n"; return -1; } @@ -158,10 +159,10 @@ main(int argc, char **argv) }); main_window.setCentralWidget(&view); - if (!start_hidden) { - main_window.show(); - } else { - tray.show(); + main_window.show(); + if (start_hidden) { + main_window.hide(); } + app.setQuitOnLastWindowClosed(false); return app.exec(); } |