From cad85fcf25077d9818b4051d045b7c81f0109422 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 11 Feb 2024 02:20:08 +0100 Subject: flatpak: launch kms server proxy instead of gsr-kms-server --- kms/client/kms_client.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/kms/client/kms_client.c b/kms/client/kms_client.c index 4d69ee1..5306145 100644 --- a/kms/client/kms_client.c +++ b/kms/client/kms_client.c @@ -193,6 +193,9 @@ int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) { } const bool inside_flatpak = getenv("FLATPAK_ID") != NULL; + const char *home = getenv("HOME"); + if(!home) + home = "/tmp"; bool has_perm = 0; if(geteuid() == 0) { @@ -251,19 +254,8 @@ int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) { goto err; } else if(pid == 0) { /* child */ if(inside_flatpak) { - if(has_perm) { - const char *args[] = { "flatpak-spawn", "--host", "/var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/bin/gsr-kms-server", self->initial_socket_path, card_path, NULL }; - execvp(args[0], (char *const*)args); - } else { - const char *args[] = { "flatpak-spawn", "--host", "pkexec", "/var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/bin/gsr-kms-server", self->initial_socket_path, card_path, NULL }; - execvp(args[0], (char *const*)args); - - // If above fails for whatever reason we try this. Maybe some distros dont install flatpak in /var/lib/flatpak/app ? - { - const char *args2[] = { "flatpak-spawn", "--host", "pkexec", "flatpak", "run", "--command=gsr-kms-server", "com.dec05eba.gpu_screen_recorder", self->initial_socket_path, card_path, NULL }; - execvp(args2[0], (char *const*)args2); - } - } + const char *args[] = { "flatpak-spawn", "--host", "/var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/bin/kms-server-proxy", self->initial_socket_path, card_path, home, NULL }; + execvp(args[0], (char *const*)args); } else if(has_perm) { const char *args[] = { server_filepath, self->initial_socket_path, card_path, NULL }; execvp(args[0], (char *const*)args); -- cgit v1.2.3