mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-05-06 06:50:43 +09:00
flatpak: launch kms server proxy instead of gsr-kms-server
This commit is contained in:
@@ -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 bool inside_flatpak = getenv("FLATPAK_ID") != NULL;
|
||||||
|
const char *home = getenv("HOME");
|
||||||
|
if(!home)
|
||||||
|
home = "/tmp";
|
||||||
|
|
||||||
bool has_perm = 0;
|
bool has_perm = 0;
|
||||||
if(geteuid() == 0) {
|
if(geteuid() == 0) {
|
||||||
@@ -251,19 +254,8 @@ int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) {
|
|||||||
goto err;
|
goto err;
|
||||||
} else if(pid == 0) { /* child */
|
} else if(pid == 0) { /* child */
|
||||||
if(inside_flatpak) {
|
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/kms-server-proxy", self->initial_socket_path, card_path, home, NULL };
|
||||||
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);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if(has_perm) {
|
} else if(has_perm) {
|
||||||
const char *args[] = { server_filepath, self->initial_socket_path, card_path, NULL };
|
const char *args[] = { server_filepath, self->initial_socket_path, card_path, NULL };
|
||||||
execvp(args[0], (char *const*)args);
|
execvp(args[0], (char *const*)args);
|
||||||
|
|||||||
Reference in New Issue
Block a user