diff options
-rw-r--r-- | src/main.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index 15855b1..ebd56e6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2778,7 +2778,7 @@ static gboolean on_click_switch_to_new_ui(GtkButton*, gpointer) { return true; } - int exit_code = system("flatpak-spawn --host -- /var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/bin/kms-server-proxy setup-gsr-ui"); + const int exit_code = system("flatpak-spawn --host -- /var/lib/flatpak/app/com.dec05eba.gpu_screen_recorder/current/active/files/bin/kms-server-proxy setup-gsr-ui"); if(exit_code != 0) { GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Failed to setup the new UI. You either cancelled the installation or you don't have pkexec installed and a polkit agent running."); @@ -2787,8 +2787,10 @@ static gboolean on_click_switch_to_new_ui(GtkButton*, gpointer) { return true; } - exit_code = 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_CONFIG_HOME:-$HOME/.config}/systemd/user/gpu-screen-recorder-ui.service\" && systemctl --user daemon-reload && systemctl enable --user gpu-screen-recorder-ui"); - if(exit_code != 0) { + bool 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_CONFIG_HOME:-$HOME/.config}/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 --user gpu-screen-recorder-ui") == 0); + if(!service_install_successful) { GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Failed to add GPU Screen Recorder to system startup. If you want the new UI to start on system startup then you need to add this command to system startup:\n" "flatpak run com.dec05eba.gpu_screen_recorder gsr-ui"); |