diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-12-29 15:21:38 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-12-29 15:21:38 +0100 |
commit | b96b877a1a5c96d3d8982e43637d4223fdf99c14 (patch) | |
tree | 195bb3163e288c6e9d450ecfabb785819c6cfe65 /src/main.cpp | |
parent | c5c79bec64a991f350632f02f59d25c3d61d01fc (diff) |
Only allow one instance of gsr-ui to run
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 1e74ddc..3abccd0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,7 @@ #include "../include/GlobalHotkeysX11.hpp" #include "../include/GlobalHotkeysLinux.hpp" #include "../include/gui/Utils.hpp" +#include "../include/Process.hpp" #include <unistd.h> #include <signal.h> @@ -170,6 +171,13 @@ int main(int argc, char **argv) { usage(); } + const pid_t gsr_ui_pid = gsr::pidof("gsr-ui"); + if(gsr_ui_pid != -1) { + const char *args[] = { "gsr-notify", "--text", "Another instance of GPU Screen Recorder UI is already running", "--timeout", "5.0", "--icon-color", "ff0000", "--bg-color", "ff0000", nullptr }; + gsr::exec_program_daemonized(args); + return 1; + } + // Cant get window texture when prime-run is used disable_prime_run(); |