diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-01-18 17:50:16 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-01-18 17:50:16 +0100 |
commit | 9f40aeddc5a0a9bc34c77d5f5c6e2fd8236ab378 (patch) | |
tree | 62ef98d8207930d33b27f90c8e071531233623fe /src/GlobalHotkeysLinux.cpp | |
parent | 62d5daad905c6cd47e43f71b03e3eeaf120ae1cb (diff) |
Flatpak: fix xopendisplay not working for global hotkey
Diffstat (limited to 'src/GlobalHotkeysLinux.cpp')
-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 }; |