aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-01-18 17:50:16 +0100
committerdec05eba <dec05eba@protonmail.com>2025-01-18 17:50:16 +0100
commit9f40aeddc5a0a9bc34c77d5f5c6e2fd8236ab378 (patch)
tree62ef98d8207930d33b27f90c8e071531233623fe
parent62d5daad905c6cd47e43f71b03e3eeaf120ae1cb (diff)
Flatpak: fix xopendisplay not working for global hotkey
-rw-r--r--src/GlobalHotkeysLinux.cpp8
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 };