Only allow one instance of gsr-ui to run

This commit is contained in:
dec05eba
2024-12-29 15:21:38 +01:00
parent c5c79bec64
commit b96b877a1a
4 changed files with 54 additions and 8 deletions

View File

@@ -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();