From 0dde8b195fc62e0d05933e094f5ae09bc917cf09 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Fri, 20 Sep 2024 16:45:16 +0200 Subject: wait until tray is available --- .direnv/flake-profile | 1 + .direnv/flake-profile-2-link | 1 + .envrc | 1 + src/main.cpp | 9 +++++++++ 4 files changed, 12 insertions(+) create mode 120000 .direnv/flake-profile create mode 120000 .direnv/flake-profile-2-link create mode 100644 .envrc 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 diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..c4b17d7 --- /dev/null +++ b/.envrc @@ -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 #include +#include + +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(); } -- cgit v1.2.3-70-g09d2