diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-10-27 15:07:24 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-10-27 15:07:24 +0100 |
commit | cd89668d0c4fabeafe5b65223e58d652b6542519 (patch) | |
tree | 8a2c2b4bce44620db51e40218f90960af09ecd6e /src/main.cpp | |
parent | 3206458c8da8d950298558df54e90907a4cc539b (diff) |
Reduce cpu usage when ui is not visible
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 3d367fa..0cc8076 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,6 +7,7 @@ #include <unistd.h> #include <signal.h> +#include <thread> #include <X11/keysym.h> #include <mglpp/mglpp.hpp> @@ -160,7 +161,8 @@ int main(int argc, char **argv) { global_hotkeys.poll_events(); overlay->handle_events(); - overlay->draw(); + if(!overlay->draw()) + std::this_thread::sleep_for(std::chrono::milliseconds(50)); } fprintf(stderr, "info: shutting down!\n"); |