diff options
-rw-r--r-- | src/GlobalHotkeysLinux.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/GlobalHotkeysLinux.cpp b/src/GlobalHotkeysLinux.cpp index 3d1813d..418e317 100644 --- a/src/GlobalHotkeysLinux.cpp +++ b/src/GlobalHotkeysLinux.cpp @@ -49,6 +49,12 @@ namespace gsr { char gsr_global_hotkeys_flatpak[PATH_MAX]; snprintf(gsr_global_hotkeys_flatpak, sizeof(gsr_global_hotkeys_flatpak), "%s/.local/share/gpu-screen-recorder/gsr-global-hotkeys", user_homepath); + const char *display = getenv("DISPLAY"); + if(!display) + display = ":0"; + char env_arg[256]; + snprintf(env_arg, sizeof(env_arg), "--env=DISPLAY=%s", display); + if(process_id > 0) return false; @@ -70,7 +76,7 @@ namespace gsr { } if(inside_flatpak) { - const char *args[] = { "flatpak-spawn", "--host", "--", gsr_global_hotkeys_flatpak, grab_type_arg, nullptr }; + const char *args[] = { "flatpak-spawn", "--host", env_arg, "--", gsr_global_hotkeys_flatpak, grab_type_arg, nullptr }; execvp(args[0], (char* const*)args); } else { const char *args[] = { "gsr-global-hotkeys", grab_type_arg, nullptr }; |