From 2355550bafe44207e7465d0454cb0af0a55dfd8f Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Sun, 3 Mar 2024 18:37:56 +0100 Subject: change `--hidden` flag to `--open-at-startup` --- src/main.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') 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 #include #include #include @@ -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 [--hidden]\n"; + std::cerr << "webtray [--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(); } -- cgit v1.2.3-70-g09d2