diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-02-11 02:20:08 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-02-11 02:20:08 +0100 |
commit | cad85fcf25077d9818b4051d045b7c81f0109422 (patch) | |
tree | f2ecc8587fb98398c92b9c6551c500e0dc569d68 | |
parent | aabd64aabb45d52f87f3dd6b255ee6c11ba576dd (diff) |
flatpak: launch kms server proxy instead of gsr-kms-server
-rw-r--r-- | kms/client/kms_client.c | 18 |
1 files 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); |