aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-04-09 16:27:37 +0200
committerdec05eba <dec05eba@protonmail.com>2023-04-09 16:27:43 +0200
commit902e18d6c5f1a6b87932582c87f56ccd4c9dac94 (patch)
treece40c45d746f2b1d8a5f44cfe55fcb84e6e743d7
parent6b78e40e256168742334897e1411fbe472b8b35a (diff)
Make sure pkexec is installed when using flatpak and for the flatpak to be installed system-wide
-rw-r--r--com.dec05eba.gpu_screen_recorder.appdata.xml4
-rw-r--r--src/main.cpp14
2 files changed, 16 insertions, 2 deletions
diff --git a/com.dec05eba.gpu_screen_recorder.appdata.xml b/com.dec05eba.gpu_screen_recorder.appdata.xml
index 5b5b498..29859a3 100644
--- a/com.dec05eba.gpu_screen_recorder.appdata.xml
+++ b/com.dec05eba.gpu_screen_recorder.appdata.xml
@@ -38,9 +38,9 @@
</screenshots>
<releases>
- <release version="2.0.0" date="2023-04-08">
+ <release version="2.0.0" date="2023-04-09">
<description>
- <p>Add experimental support for AMD/Intel. Quality might not be well tuned yet and the video is in variable framerate mode, which might cause issues with some out of date video editing software or video players</p>
+ <p>Add experimental support for AMD/Intel. Quality might not be well tuned yet and the video is in variable framerate mode, which might cause issues with some out of date video editing software or video players. Requires GPU Screen Recorder flatpak to be installed system-wide and pkexec to be installed</p>
</description>
</release>
<release version="1.3.5" date="2023-03-22">
diff --git a/src/main.cpp b/src/main.cpp
index 87a8e43..9c8636a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1540,6 +1540,10 @@ static bool is_pkexec_installed() {
return is_program_installed({ "pkexec", 6 });
}
+static bool flatpak_is_installed_as_system(void) {
+ return system("flatpak run --system --command=pwd com.dec05eba.gpu_screen_recorder") == 0;
+}
+
typedef gboolean (*KeyPressHandler)(GtkButton *button, gpointer userdata);
static void keypress_toggle_recording(bool recording_state, GtkButton *record_button, KeyPressHandler keypress_handler, GtkApplication *app) {
if(!gtk_widget_get_sensitive(GTK_WIDGET(record_button)))
@@ -2506,6 +2510,16 @@ static void activate(GtkApplication *app, gpointer userdata) {
g_application_quit(G_APPLICATION(app));
return;
}
+
+ if(is_inside_flatpak() && !flatpak_is_installed_as_system()) {
+ GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+ "GPU Screen Recorder needs to be installed system-wide to record your monitor on AMD/Intel. To install GPU Screen recorder system-wide, you can run this command:\n"
+ "flatpak install flathub --system com.dec05eba.gpu_screen_recorder");
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+ g_application_quit(G_APPLICATION(app));
+ return;
+ }
}
std::string window_title = "GPU Screen Recorder | Running on ";