From b96b877a1a5c96d3d8982e43637d4223fdf99c14 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 29 Dec 2024 15:21:38 +0100 Subject: Only allow one instance of gsr-ui to run --- src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main.cpp') 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 #include @@ -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(); -- cgit v1.2.3