Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package gpu-screen-recorder-gtk for openSUSE:Factory checked in at 2025-01-05 15:29:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gpu-screen-recorder-gtk (Old) and /work/SRC/openSUSE:Factory/.gpu-screen-recorder-gtk.new.1881 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gpu-screen-recorder-gtk" Sun Jan 5 15:29:21 2025 rev:12 rq:1234647 version:20250102 Changes: -------- --- /work/SRC/openSUSE:Factory/gpu-screen-recorder-gtk/gpu-screen-recorder-gtk.changes 2024-12-03 20:47:28.647713758 +0100 +++ /work/SRC/openSUSE:Factory/.gpu-screen-recorder-gtk.new.1881/gpu-screen-recorder-gtk.changes 2025-01-05 15:29:32.385525959 +0100 @@ -1,0 +2,16 @@ +Fri Jan 03 04:11:10 UTC 2025 - mantari...@pm.me + +- Update to version 20250102: + * Fix regression: incorrect window resulting in incorrect game + name for video, and background for uncomposited x11 + * Fix unable to properly add program to system startup on + immutable distros + * Fix streaming not working in the new UI + * Open the running new UI when trying to launch it again instead + of showing an error, to allow switching back to the old UI in + case of errors + * Add a new experimental UI, a ShadowPlay-like fullscreen + overlay UI with support for global hotkeys on any Wayland + compositor + +------------------------------------------------------------------- Old: ---- gpu-screen-recorder-gtk-20241124.tar.zst New: ---- gpu-screen-recorder-gtk-20250102.tar.zst ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gpu-screen-recorder-gtk.spec ++++++ --- /var/tmp/diff_new_pack.MeeYuA/_old 2025-01-05 15:29:33.073554259 +0100 +++ /var/tmp/diff_new_pack.MeeYuA/_new 2025-01-05 15:29:33.077554424 +0100 @@ -1,7 +1,7 @@ # # spec file for package gpu-screen-recorder-gtk # -# Copyright (c) 2024 mantarimay +# Copyright (c) 2025 mantarimay # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %bcond_with test %define appid com.dec05eba.gpu_screen_recorder Name: gpu-screen-recorder-gtk -Version: 20241124 +Version: 20250102 Release: 0 Summary: GTK frontend for GPU Screen Recorder License: GPL-3.0-only ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.MeeYuA/_old 2025-01-05 15:29:33.129556563 +0100 +++ /var/tmp/diff_new_pack.MeeYuA/_new 2025-01-05 15:29:33.137556892 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://repo.dec05eba.com/gpu-screen-recorder-gtk.git</param> - <param name="changesrevision">26adb4d8189ddad7d33a74ba2f356ea97c288fd8</param></service></servicedata> + <param name="changesrevision">33071d4c8413b52d628d0253270ce3c5d3743845</param></service></servicedata> (No newline at EOF) ++++++ gpu-screen-recorder-gtk-20241124.tar.zst -> gpu-screen-recorder-gtk-20250102.tar.zst ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gpu-screen-recorder-gtk-20241124/README.md new/gpu-screen-recorder-gtk-20250102/README.md --- old/gpu-screen-recorder-gtk-20241124/README.md 2024-11-24 22:52:36.000000000 +0100 +++ new/gpu-screen-recorder-gtk-20250102/README.md 2025-01-02 15:36:27.000000000 +0100 @@ -5,9 +5,9 @@ There is a new alternative UI for GPU Screen Recorder in the style of ShadowPlay available here: [GPU Screen Recorder UI](https://git.dec05eba.com/gpu-screen-recorder-ui/). # Installation -This program depends on [GPU Screen Recorder](https://git.dec05eba.com/gpu-screen-recorder/) which needs to be installed first.\ -Run `sudo ./install.sh` or if you are running Arch Linux, then you can find gpu screen recorder gtk on aur under the name gpu-screen-recorder-gtk (`yay -S gpu-screen-recorder-gtk`).\ -You can also install gpu screen recorder (the gtk gui version) from [flathub](https://flathub.org/apps/details/com.dec05eba.gpu_screen_recorder). This flatpak includes gpu-screen-recorder so no need to install that first. +If you are using an Arch Linux based distro then you can find gpu screen recorder gtk on aur under the name gpu-screen-recorder-gtk (`yay -S gpu-screen-recorder-gtk`).\ +If you are running another distro then you can run `sudo ./install.sh`, but you need to manually install the dependencies, as described below.\ +You can also install gpu screen recorder from [flathub](https://flathub.org/apps/details/com.dec05eba.gpu_screen_recorder). This flatpak includes both this UI and gpu-screen-recorder so no need to install that first. # Dependencies GPU Screen Recorder GTK uses meson build system so you need to install `meson` to build GPU Screen Recorder GTK. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gpu-screen-recorder-gtk-20241124/TODO new/gpu-screen-recorder-gtk-20250102/TODO --- old/gpu-screen-recorder-gtk-20241124/TODO 2024-11-24 22:52:36.000000000 +0100 +++ new/gpu-screen-recorder-gtk-20250102/TODO 2025-01-02 15:36:27.000000000 +0100 @@ -69,4 +69,4 @@ Move x11 hotkey code to its own file. -Add audio devices/app refresh button. \ No newline at end of file +Detect gpu screen recorder flatpak update and restart the gsr-ui systemd service to apply the update. Or show a notification when it has been updated and can be restarted to apply update. \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gpu-screen-recorder-gtk-20241124/com.dec05eba.gpu_screen_recorder.appdata.xml new/gpu-screen-recorder-gtk-20250102/com.dec05eba.gpu_screen_recorder.appdata.xml --- old/gpu-screen-recorder-gtk-20241124/com.dec05eba.gpu_screen_recorder.appdata.xml 2024-11-24 22:52:36.000000000 +0100 +++ new/gpu-screen-recorder-gtk-20250102/com.dec05eba.gpu_screen_recorder.appdata.xml 2025-01-02 15:36:27.000000000 +0100 @@ -37,6 +37,9 @@ <li>AAC</li> </ul> <p> + At the moment the program comes with two different UIs. A gtk based one and a new experimental ShadowPlay-like fullscreen overlay UI. The gtk based UI will be removed in the future. + </p> + <p> Recording a monitor requires (restricted) root access which means that you have to install GPU Screen Recorder system-wide: "flatpak install --system com.dec05eba.gpu_screen_recorder" and pkexec needs to be installed on the system and a polkit agent needs to be running. Note that this only applies to when recording a monitor on AMD/Intel or when recording on Wayland without using the desktop portal option. @@ -61,25 +64,71 @@ You can find which NVIDIA driver version is running on your system by running "cat /proc/driver/nvidia/version". </p> <p>GPU Screen Recorder flatpak can install files in $HOME/.local/share/gpu-screen-recorder. If you want to uninstall GPU Screen Recorder then you will have to remove this directory manually.</p> + <p>If you tried out the new UI then a systemd service was added to ~/.local/share/systemd/user/gpu-screen-recorder-ui.service. If you want to uninstall GPU Screen Recorder then you will have to remove this file.</p> </description> <launchable type="desktop-id">com.dec05eba.gpu_screen_recorder.desktop</launchable> <screenshots> <screenshot type="default"> - <caption>Simple view</caption> + <caption>Front page</caption> + <image>https://raw.githubusercontent.com/dec05eba/com.dec05eba.gpu_screen_recorder/master/resources/front_page.jpg</image> + </screenshot> + <screenshot> + <caption>Settings page</caption> + <image>https://raw.githubusercontent.com/dec05eba/com.dec05eba.gpu_screen_recorder/master/resources/settings_page.jpg</image> + </screenshot> + <screenshot> + <caption>Simple view in the old UI</caption> <image>https://raw.githubusercontent.com/dec05eba/com.dec05eba.gpu_screen_recorder/master/resources/screenshot1.png</image> </screenshot> <screenshot> - <caption>Advanced view</caption> + <caption>Advanced view in the old UI</caption> <image>https://raw.githubusercontent.com/dec05eba/com.dec05eba.gpu_screen_recorder/master/resources/screenshot2.png</image> </screenshot> <screenshot> - <caption>Recording page</caption> + <caption>Recording page in the old UI</caption> <image>https://raw.githubusercontent.com/dec05eba/com.dec05eba.gpu_screen_recorder/master/resources/screenshot3.png</image> </screenshot> </screenshots> <releases> + <release version="5.0.4" date="2025-01-01"> + <description> + <ul> + <li>Fix regression: incorrect window resulting in incorrect game name for video, and background for uncomposited x11</li> + </ul> + </description> + </release> + <release version="5.0.3" date="2024-12-31"> + <description> + <ul> + <li>Fix unable to properly add program to system startup on immutable distros</li> + </ul> + </description> + </release> + <release version="5.0.2" date="2024-12-31"> + <description> + <ul> + <li>Fix streaming not working in the new UI</li> + </ul> + </description> + </release> + <release version="5.0.1" date="2024-12-30"> + <description> + <ul> + <li>Open the running new UI when trying to launch it again instead of showing an error, to allow switching back to the old UI in case of errors</li> + </ul> + </description> + </release> + <release version="5.0.0" date="2024-12-29"> + <description> + <ul> + <li>Add a new experimental UI, a ShadowPlay-like fullscreen overlay UI with support for global hotkeys on any Wayland compositor</li> + <li>Better compatibility and performance on some older AMD GPUs</li> + <li>Better handle application audio nodes, fixing possible issue with application audio not working</li> + </ul> + </description> + </release> <release version="4.3.3" date="2024-11-22"> <description> <ul> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gpu-screen-recorder-gtk-20241124/meson.build new/gpu-screen-recorder-gtk-20250102/meson.build --- old/gpu-screen-recorder-gtk-20241124/meson.build 2024-11-24 22:52:36.000000000 +0100 +++ new/gpu-screen-recorder-gtk-20250102/meson.build 2025-01-02 15:36:27.000000000 +0100 @@ -1,4 +1,4 @@ -project('gpu-screen-recorder-gtk', ['c', 'cpp'], version : '4.3.3', default_options : ['warning_level=2']) +project('gpu-screen-recorder-gtk', ['c', 'cpp'], version : '5.0.0', default_options : ['warning_level=2']) add_project_arguments('-Wshadow', language : ['c', 'cpp']) if get_option('buildtype') == 'debug' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gpu-screen-recorder-gtk-20241124/project.conf new/gpu-screen-recorder-gtk-20250102/project.conf --- old/gpu-screen-recorder-gtk-20241124/project.conf 2024-11-24 22:52:36.000000000 +0100 +++ new/gpu-screen-recorder-gtk-20250102/project.conf 2025-01-02 15:36:27.000000000 +0100 @@ -1,7 +1,7 @@ [package] name = "gpu-screen-recorder-gtk" type = "executable" -version = "4.3.3" +version = "5.0.0" platforms = ["posix"] [config] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gpu-screen-recorder-gtk-20241124/src/config.hpp new/gpu-screen-recorder-gtk-20250102/src/config.hpp --- old/gpu-screen-recorder-gtk-20241124/src/config.hpp 2024-11-24 22:52:36.000000000 +0100 +++ new/gpu-screen-recorder-gtk-20250102/src/config.hpp 2025-01-02 15:36:27.000000000 +0100 @@ -48,6 +48,8 @@ bool hevc_amd_bug_warning_shown = false; bool av1_amd_bug_warning_shown = false; bool restore_portal_session = true; + bool use_new_ui = false; + int32_t installed_gsr_global_hotkeys_version = 0; }; struct YoutubeStreamConfig { @@ -334,6 +336,8 @@ {"main.hevc_amd_bug_warning_shown", {CONFIG_TYPE_BOOL, &config.main_config.hevc_amd_bug_warning_shown}}, {"main.av1_amd_bug_warning_shown", {CONFIG_TYPE_BOOL, &config.main_config.av1_amd_bug_warning_shown}}, {"main.restore_portal_session", {CONFIG_TYPE_BOOL, &config.main_config.restore_portal_session}}, + {"main.use_new_ui", {CONFIG_TYPE_BOOL, &config.main_config.use_new_ui}}, + {"main.installed_gsr_global_hotkeys_version", {CONFIG_TYPE_I32, &config.main_config.installed_gsr_global_hotkeys_version}}, {"streaming.service", {CONFIG_TYPE_STRING, &config.streaming_config.streaming_service}}, {"streaming.youtube.key", {CONFIG_TYPE_STRING, &config.streaming_config.youtube.stream_key}}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gpu-screen-recorder-gtk-20241124/src/main.cpp new/gpu-screen-recorder-gtk-20250102/src/main.cpp --- old/gpu-screen-recorder-gtk-20241124/src/main.cpp 2024-11-24 22:52:36.000000000 +0100 +++ new/gpu-screen-recorder-gtk-20250102/src/main.cpp 2025-01-02 15:36:27.000000000 +0100 @@ -20,6 +20,8 @@ #include <vector> #include <libayatana-appindicator/app-indicator.h> +#define GSR_CURRENT_GLOBAL_HOTKEYS_CODE_VERSION 1 + #ifndef GSR_VERSION #define GSR_VERSION "unknown" #endif @@ -151,6 +153,7 @@ static bool streaming = false; static pid_t gpu_screen_recorder_process = -1; static int prev_exit_status = -1; +static bool config_empty = false; static Config config; static std::string record_file_current_filename; static bool nvfbc_installed = false; @@ -241,7 +244,6 @@ struct SupportedCaptureOptions { bool window = false; bool focused = false; - bool screen = false; bool portal = false; std::vector<GsrMonitor> monitors; }; @@ -1033,6 +1035,7 @@ 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; @@ -1396,13 +1399,13 @@ if(flatpak && !flatpak_is_installed_as_system()) { if(gsr_info.system_info.display_server == DisplayServer::WAYLAND) { GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "GPU Screen Recorder needs to be installed system-wide to record your monitor on Wayland when not using the portal option. To install GPU Screen recorder system-wide, you can run this command:\n" + "GPU Screen Recorder needs to be installed system-wide to record your monitor on Wayland when not using the portal option. You can run this command to install GPU Screen recorder system-wide:\n" "flatpak install --system com.dec05eba.gpu_screen_recorder\n"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } else { GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window), 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 when not using the portal option. To install GPU Screen recorder system-wide, you can run this command:\n" + "GPU Screen Recorder needs to be installed system-wide to record your monitor on AMD/Intel when not using the portal option. You can run this command to install GPU Screen recorder system-wide:\n" "flatpak install --system com.dec05eba.gpu_screen_recorder\n" "Alternatively, record a single window which doesn't have this restriction."); gtk_dialog_run(GTK_DIALOG(dialog)); @@ -2595,8 +2598,6 @@ _gsr_info->supported_capture_options.window = true; else if(line == "focused") _gsr_info->supported_capture_options.focused = true; - else if(line == "screen") - _gsr_info->supported_capture_options.screen = true; else if(line == "portal") _gsr_info->supported_capture_options.portal = true; else @@ -2706,6 +2707,112 @@ g_free(id); } +static void launch_gsr_ui(bool show_ui) { + const char *args[] = { "gsr-ui", show_ui ? "launch-show" : "launch-hide", nullptr }; + execvp(args[0], (char* const*)args); + GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "gsr-ui (gpu-screen-recorder-ui) isn't installed. Please install it first."); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); +} + +static gboolean on_click_switch_to_new_ui(GtkButton*, gpointer) { + if(!dpy) { + GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "The new UI only works on X11 or through XWayland on Wayland. Native Wayland is not supported because Wayland is missing features required by this software.\n" + "Install X11 on your system to use the new UI."); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + return true; + } + + if(!is_pkexec_installed()) { + GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "pkexec needs to be installed to switch to the new UI"); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + return true; + } + + if(!flatpak_is_installed_as_system()) { + GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "GPU Screen Recorder needs to be installed system-wide to use the new UI. You can run this command to install GPU Screen recorder system-wide:\n" + "flatpak install --system com.dec05eba.gpu_screen_recorder\n"); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + return true; + } + + GtkWidget *dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, + "You are about to try out the new UI, which is a ShadowPlay-like fullscreen UI. It runs in the background and you have to show/hide it by pressing Alt+Z.\n" + "This new UI is still experimental and you may experience issues depending on your system. You can switch back to the old UI at any time by opening the UI and clicking on the settings button and clicking on the \"Go back to the old UI\" button.\n" + "Note that at the moment it assumes you are using a keyboard with qwerty layout. If you are using another keyboard layout then instead of pressing Alt+Z you have to press the key that has been switched the with Z key.\n" + "\n" + "This new UI comes with new features, such as being able to automatically launch it on system startup by enabling it in settings, and hotkey support on any Wayland compositor.\n" + "\n" + "If you are using an NVIDIA GPU then you may experience issue with recording/replay if a suspend happens while recording/using replay. This is an NVIDIA driver issue and it also happens in the old UI.\n" + "See this for a workaround: <a href=\"https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend\">Arch Wiki - Preserve video memory after suspend</a>.\n" + "\n" + "Are you sure you want to switch to the new UI?"); + gint response = gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + + switch(response) { + case GTK_RESPONSE_YES: + break; + case GTK_RESPONSE_NO: + default: + return true; + } + + dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, + "The new UI needs root privileges to finish setup to make global hotkeys and recording work on any system. The new UI will also be added to system startup.\n" + "\n" + "Are you sure you want to continue?"); + response = gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + + switch(response) { + case GTK_RESPONSE_YES: + break; + case GTK_RESPONSE_NO: + default: + return true; + } + + 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."); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + return true; + } + + config.main_config.use_new_ui = true; + config.main_config.installed_gsr_global_hotkeys_version = GSR_CURRENT_GLOBAL_HOTKEYS_CODE_VERSION; + save_configs(); + + bool service_install_successful = (system( + "data_home=$(flatpak-spawn --host -- /bin/sh -c 'echo \"${XDG_DATA_HOME:-$HOME/.local/share}\"') && " + "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 \"$data_home/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) { + 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"); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + } + + if(!service_install_successful) + launch_gsr_ui(true); + + g_application_quit(G_APPLICATION(select_window_userdata.app)); + return true; +} + static GtkWidget* create_common_settings_page(GtkStack *stack, GtkApplication *app) { GtkGrid *main_grid = GTK_GRID(gtk_grid_new()); gtk_stack_add_named(stack, GTK_WIDGET(main_grid), "common-settings"); @@ -2723,7 +2830,9 @@ int notifications_area_row = 0; GtkGrid *simple_advanced_grid = GTK_GRID(gtk_grid_new()); - gtk_grid_attach(main_grid, GTK_WIDGET(simple_advanced_grid), 0, main_grid_row++, 2, 1); + gtk_grid_set_column_spacing(simple_advanced_grid, 10); + gtk_grid_attach(main_grid, GTK_WIDGET(simple_advanced_grid), 0, main_grid_row++, flatpak ? 3 : 2, 1); + gtk_grid_attach(simple_advanced_grid, gtk_label_new("View: "), 0, 0, 1, 1); view_combo_box = GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new()); g_signal_connect(view_combo_box, "scroll-event", G_CALLBACK(scroll_event_ignore), NULL); @@ -2734,6 +2843,12 @@ gtk_combo_box_set_active(GTK_COMBO_BOX(view_combo_box), 0); g_signal_connect(view_combo_box, "changed", G_CALLBACK(view_combo_box_change_callback), view_combo_box); + if(flatpak) { + GtkButton *switch_to_new_ui_button = GTK_BUTTON(gtk_button_new_with_label("Try out the new UI")); + gtk_grid_attach(simple_advanced_grid, GTK_WIDGET(switch_to_new_ui_button), 2, 0, 1, 1); + g_signal_connect(switch_to_new_ui_button, "clicked", G_CALLBACK(on_click_switch_to_new_ui), nullptr); + } + GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL, NULL)); gtk_scrolled_window_set_min_content_width(scrolled_window, 100); gtk_scrolled_window_set_min_content_height(scrolled_window, 100); @@ -2796,12 +2911,6 @@ const bool allow_screen_capture = is_monitor_capture_drm() || nvfbc_installed; if(allow_screen_capture) { - if(gsr_info.supported_capture_options.screen) { - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, "All monitors", -1); - gtk_list_store_set(store, &iter, 1, "screen", -1); - } - for(const auto &monitor : gsr_info.supported_capture_options.monitors) { std::string label = "Monitor "; label += monitor.name; @@ -2852,7 +2961,9 @@ gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(record_area_selection_menu), renderer, "text", 0, NULL); gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(record_area_selection_menu), renderer, record_area_set_sensitive, NULL, NULL); - if(allow_screen_capture || gsr_info.supported_capture_options.portal) + if(allow_screen_capture && !gsr_info.supported_capture_options.portal && gsr_info.supported_capture_options.monitors.empty()) + gtk_combo_box_set_active(record_area_selection_menu, 0); + else if(allow_screen_capture || gsr_info.supported_capture_options.portal) gtk_combo_box_set_active(record_area_selection_menu, 2); else gtk_combo_box_set_active(record_area_selection_menu, 0); @@ -3061,42 +3172,44 @@ gtk_list_store_set(store, &iter, 1, "hevc", -1); gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.av1 ? "AV1 (Smallest file size, worst software compatibility)" : "AV1 (Not available on your system)", -1); - gtk_list_store_set(store, &iter, 1, "av1", -1); - - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.vp8 ? "VP8" : "VP8 (Not available on your system)", -1); - gtk_list_store_set(store, &iter, 1, "vp8", -1); - - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.vp9 ? "VP9" : "VP9 (Not available on your system)", -1); - gtk_list_store_set(store, &iter, 1, "vp9", -1); + gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.hevc ? "HEVC (10 bit, reduces banding)" : "HEVC (10 bit, not available on your system)", -1); + gtk_list_store_set(store, &iter, 1, "hevc_10bit", -1); if(gsr_info.system_info.display_server == DisplayServer::WAYLAND) { gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.hevc ? "HEVC (HDR)" : "HEVC (HDR, not available on your system)", -1); gtk_list_store_set(store, &iter, 1, "hevc_hdr", -1); - - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.av1 ? "AV1 (HDR)" : "AV1 (HDR, not available on your system)", -1); - gtk_list_store_set(store, &iter, 1, "av1_hdr", -1); } else { gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, "HEVC (HDR, not available on X11)", -1); gtk_list_store_set(store, &iter, 1, "hevc_hdr", -1); + } + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.av1 ? "AV1 (Smallest file size, worst software compatibility)" : "AV1 (Not available on your system)", -1); + gtk_list_store_set(store, &iter, 1, "av1", -1); + + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.av1 ? "AV1 (10 bit, reduces banding)" : "AV1 (10 bit, not available on your system)", -1); + gtk_list_store_set(store, &iter, 1, "av1_10bit", -1); + + if(gsr_info.system_info.display_server == DisplayServer::WAYLAND) { + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.av1 ? "AV1 (HDR)" : "AV1 (HDR, not available on your system)", -1); + gtk_list_store_set(store, &iter, 1, "av1_hdr", -1); + } else { gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, "AV1 (HDR, not available on X11)", -1); gtk_list_store_set(store, &iter, 1, "av1_hdr", -1); } gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.hevc ? "HEVC (10 bit, reduces banding)" : "HEVC (10 bit, not available on your system)", -1); - gtk_list_store_set(store, &iter, 1, "hevc_10bit", -1); + gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.vp8 ? "VP8" : "VP8 (Not available on your system)", -1); + gtk_list_store_set(store, &iter, 1, "vp8", -1); gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.av1 ? "AV1 (10 bit, reduces banding)" : "AV1 (10 bit, not available on your system)", -1); - gtk_list_store_set(store, &iter, 1, "av1_10bit", -1); + gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.vp9 ? "VP9" : "VP9 (Not available on your system)", -1); + gtk_list_store_set(store, &iter, 1, "vp9", -1); gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, gsr_info.supported_video_codecs.h264_software ? "H264 Software Encoder (Slow, not recommeded)" : "H264 Software Encoder (Not available on your system)", -1); @@ -3903,16 +4016,11 @@ } static void load_config() { - bool config_empty = false; - config = read_config(config_empty); - std::string first_monitor; if(gsr_info.system_info.display_server != DisplayServer::WAYLAND && strcmp(config.main_config.record_area_option.c_str(), "window") == 0) { // } else if(gsr_info.system_info.display_server != DisplayServer::WAYLAND && strcmp(config.main_config.record_area_option.c_str(), "focused") == 0) { // - } else if(gsr_info.system_info.display_server != DisplayServer::WAYLAND && gsr_info.gpu_info.vendor == GpuVendor::NVIDIA && strcmp(config.main_config.record_area_option.c_str(), "screen") == 0) { - // } else if(config.main_config.record_area_option == "portal" && gsr_info.supported_capture_options.portal && gsr_info.system_info.display_server == DisplayServer::WAYLAND) { // } else { @@ -4195,7 +4303,7 @@ if(gsr_info.system_info.display_server == DisplayServer::X11 && !dpy) { GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "Failed to connect to X11 server"); + "Failed to connect to the X11 server"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); g_application_quit(G_APPLICATION(app)); @@ -4236,7 +4344,7 @@ #else const char *icon_path = "/usr/share/icons"; #endif - gtk_icon_theme_set_search_path(icon_theme, &icon_path, 1); + gtk_icon_theme_prepend_search_path(icon_theme, icon_path); const char *icon_name = "com.dec05eba.gpu_screen_recorder"; if(!gtk_icon_theme_has_icon(icon_theme, icon_name)) @@ -4320,15 +4428,124 @@ } } +static bool kms_server_proxy_setup_gsr_ui(const char *msg) { + GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", msg); + const gint response = gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + + switch(response) { + case GTK_RESPONSE_YES: + break; + case GTK_RESPONSE_NO: + default: { + config.main_config.use_new_ui = false; + save_config(config); + return false; + } + } + + 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."); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + + config.main_config.use_new_ui = false; + save_configs(); + return false; + } + + config.main_config.use_new_ui = true; + config.main_config.installed_gsr_global_hotkeys_version = GSR_CURRENT_GLOBAL_HOTKEYS_CODE_VERSION; + save_config(config); + return true; +} + +static bool is_gsr_global_hotkeys_installed() { + const char *user_homepath = getenv("HOME"); + if(!user_homepath) + user_homepath = "/tmp"; + + char path[PATH_MAX]; + snprintf(path, sizeof(path), "%s/.local/share/gpu-screen-recorder/gsr-global-hotkeys", user_homepath); + return access(path, F_OK) == 0; +} + +static bool is_kms_server_proxy_installed() { + const char *user_homepath = getenv("HOME"); + if(!user_homepath) + user_homepath = "/tmp"; + + char path[PATH_MAX]; + snprintf(path, sizeof(path), "%s/.local/share/gpu-screen-recorder/kms-server-proxy-1", user_homepath); + return access(path, F_OK) == 0; +} + +static void startup_new_ui(bool launched_by_daemon) { + if(!dpy) { + if(launched_by_daemon) { + fprintf(stderr, "Error: failed to connect to the X11 server, assuming no graphical session has started yet\n"); + exit(1); + } else { + GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "Failed to connect to the X11 server while trying to start the new GPU Screen Recorder UI. Please install X11 on your system to use the new UI"); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + + config.main_config.use_new_ui = false; + save_config(config); + return; + } + } + + if(config.main_config.installed_gsr_global_hotkeys_version != GSR_CURRENT_GLOBAL_HOTKEYS_CODE_VERSION) { + if(!kms_server_proxy_setup_gsr_ui( + "An update is available. The new GPU Screen Recorder UI needs root privileges to finish update to make global hotkeys and recording work on any system.\n" + "\n" + "Are you sure you want to continue?")) + { + return; + } + } else if(!is_gsr_global_hotkeys_installed() || !is_kms_server_proxy_installed()) { + if(!kms_server_proxy_setup_gsr_ui( + "Required files are missing to launch the new GPU Screen Recorder UI. These files will be installed again.\n" + "\n" + "Are you sure you want to continue?")) + { + return; + } + } + + launch_gsr_ui(!launched_by_daemon); + exit(0); +} + int main(int argc, char **argv) { setlocale(LC_ALL, "C"); + const bool use_old_ui_opt = argc == 2 && strcmp(argv[1], "use-old-ui") == 0; + const bool launched_by_daemon_opt = argc == 2 && strcmp(argv[1], "gsr-ui") == 0; + argc = 1; + if(geteuid() == 0) { fprintf(stderr, "Error: don't run gpu-screen-recorder-gtk as the root user\n"); return 1; } dpy = XOpenDisplay(NULL); + + config_empty = false; + config = read_config(config_empty); + + if(use_old_ui_opt) { + system("flatpak-spawn --host -- systemctl disable --user gpu-screen-recorder-ui"); + config.main_config.use_new_ui = false; + save_config(config); + } + + if(config.main_config.use_new_ui) + startup_new_ui(launched_by_daemon_opt); + gsr_info_exit_status = get_gpu_screen_recorder_info(&gsr_info); if(gsr_info_exit_status == GsrInfoExitStatus::OK) {