diff options
author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-09-20 16:45:16 +0200 |
---|---|---|
committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-09-20 16:45:16 +0200 |
commit | 0dde8b195fc62e0d05933e094f5ae09bc917cf09 (patch) | |
tree | 25ff9b928e23950dcd015afd16aa939506c320cc /src | |
parent | 5756b833718d8b7bc8db378dd9dbebc52aa61220 (diff) |
wait until tray is available
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index e40f387..cf14cf6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,9 @@ #include <QtWidgets/QApplication> #include <iostream> +#include <thread> + +using namespace std::chrono_literals; #include "permissionmanager.hpp" #include "tray.hpp" @@ -42,6 +45,7 @@ main(int argc, char **argv) WebWindow webwindow(url); Tray tray; + bool start_hidden = not app.arguments().contains("--open-at-startup"); for (auto feature : features) { @@ -70,5 +74,10 @@ main(int argc, char **argv) if (start_hidden) { webwindow.hide(); } + + while (!tray.isSystemTrayAvailable()) { + std::this_thread::sleep_for(50ms); + }; + return app.exec(); } |