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 | |
parent | 5756b833718d8b7bc8db378dd9dbebc52aa61220 (diff) |
wait until tray is available
l--------- | .direnv/flake-profile | 1 | ||||
l--------- | .direnv/flake-profile-2-link | 1 | ||||
-rw-r--r-- | .envrc | 1 | ||||
-rw-r--r-- | src/main.cpp | 9 |
4 files changed, 12 insertions, 0 deletions
diff --git a/.direnv/flake-profile b/.direnv/flake-profile new file mode 120000 index 0000000..c7ae5b7 --- /dev/null +++ b/.direnv/flake-profile @@ -0,0 +1 @@ +flake-profile-2-link
\ No newline at end of file diff --git a/.direnv/flake-profile-2-link b/.direnv/flake-profile-2-link new file mode 120000 index 0000000..5175965 --- /dev/null +++ b/.direnv/flake-profile-2-link @@ -0,0 +1 @@ +/nix/store/b70fhnqlc2jw2y0ihbblpgskw26iypc8-webtray-env
\ No newline at end of file @@ -0,0 +1 @@ +use_flake 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(); } |