From bbe4d09ac0b4045dfdad43cea58ab781867d83ea Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 31 Dec 2024 17:14:03 +0100 Subject: Fix unable to properly add program to system startup on immutable distros --- com.dec05eba.gpu_screen_recorder.appdata.xml | 7 +++++++ src/main.cpp | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/com.dec05eba.gpu_screen_recorder.appdata.xml b/com.dec05eba.gpu_screen_recorder.appdata.xml index 7b27f70..c6afe46 100644 --- a/com.dec05eba.gpu_screen_recorder.appdata.xml +++ b/com.dec05eba.gpu_screen_recorder.appdata.xml @@ -92,6 +92,13 @@ + + +
    +
  • Fix unable to properly add program to system startup on immutable distros
  • +
+
+
    diff --git a/src/main.cpp b/src/main.cpp index c22634d..0542b8a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1035,6 +1035,7 @@ static GdkFilterReturn filter_callback(GdkXEvent *xevent, GdkEvent*, gpointer us return GDK_FILTER_CONTINUE; Window target_win = ev->xbutton.subwindow; + // TODO: Fix, this is incorrect when trying to record steam window. For steam window Window new_window = window_get_target_window_child(_select_window_userdata->display, target_win); if(new_window) target_win = new_window; @@ -2788,7 +2789,8 @@ static gboolean on_click_switch_to_new_ui(GtkButton*, gpointer) { return true; } - bool service_install_successful = system("flatpak-spawn --host -- pkexec install -Dm644 /var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/share/gpu-screen-recorder/gpu-screen-recorder-ui.service /usr/lib/systemd/user/gpu-screen-recorder-ui.service") == 0; + bool service_install_successful = (system("flatpak-spawn --host -- pkexec rm /usr/lib/systemd/user/gpu-screen-recorder-ui.service") <= 1); + service_install_successful &= (system("flatpak-spawn --host -- install -Dm644 /var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/share/gpu-screen-recorder/gpu-screen-recorder-ui.service \"${XDG_DATA_HOME:-$HOME/.local/share}/systemd/user/gpu-screen-recorder-ui.service\"") == 0); service_install_successful &= (system("flatpak-spawn --host -- systemctl --user daemon-reload") == 0); service_install_successful &= (system("flatpak-spawn --host -- systemctl enable --now --user gpu-screen-recorder-ui") == 0); if(!service_install_successful) { -- cgit v1.2.3