From 182c96d8e9868897b35ecfcd0d2feccce5148c0b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 18 Jul 2025 23:45:34 +0200 Subject: [PATCH] Hide UI when starting desktop portal capture (because the desktop portal selection needs to be clicked on) --- include/Overlay.hpp | 2 ++ src/Overlay.cpp | 20 ++++++++++++++++++++ src/gui/ScreenshotSettingsPage.cpp | 2 +- src/gui/SettingsPage.cpp | 2 +- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/include/Overlay.hpp b/include/Overlay.hpp index 3de89c2..30ec21d 100644 --- a/include/Overlay.hpp +++ b/include/Overlay.hpp @@ -229,5 +229,7 @@ namespace gsr { std::unique_ptr cursor_tracker; mgl::Clock cursor_tracker_update_clock; + + bool hide_ui = false; }; } \ No newline at end of file diff --git a/src/Overlay.cpp b/src/Overlay.cpp index fca95bb..c698cff 100644 --- a/src/Overlay.cpp +++ b/src/Overlay.cpp @@ -758,6 +758,12 @@ namespace gsr { update_gsr_screenshot_process_status(); replay_status_update_status(); + if(hide_ui) { + hide_ui = false; + hide(); + return false; + } + if(start_region_capture) { start_region_capture = false; hide(); @@ -1338,6 +1344,8 @@ namespace gsr { if(!visible) return; + hide_ui = false; + mgl_context *context = mgl_get_context(); Display *display = (Display*)context->connection; @@ -2588,6 +2596,9 @@ namespace gsr { show_notification(msg, notification_timeout_seconds, get_color_theme().tint_color, get_color_theme().tint_color, NotificationType::REPLAY, recording_capture_target.c_str()); } + if(config.replay_config.record_options.record_area_option == "portal") + hide_ui = true; + return true; } @@ -2747,6 +2758,9 @@ namespace gsr { snprintf(msg, sizeof(msg), "Started recording %s", capture_target_get_notification_name(recording_capture_target.c_str()).c_str()); show_notification(msg, notification_timeout_seconds, get_color_theme().tint_color, get_color_theme().tint_color, NotificationType::RECORD, recording_capture_target.c_str()); } + + if(config.record_config.record_options.record_area_option == "portal") + hide_ui = true; } static std::string streaming_get_url(const Config &config) { @@ -2921,6 +2935,9 @@ namespace gsr { snprintf(msg, sizeof(msg), "Started streaming %s", capture_target_get_notification_name(recording_capture_target.c_str()).c_str()); show_notification(msg, notification_timeout_seconds, get_color_theme().tint_color, get_color_theme().tint_color, NotificationType::STREAM, recording_capture_target.c_str()); } + + if(config.streaming_config.record_options.record_area_option == "portal") + hide_ui = true; } void Overlay::on_press_take_screenshot(bool finished_selection, bool force_region_capture) { @@ -2995,6 +3012,9 @@ namespace gsr { if(gpu_screen_recorder_screenshot_process == -1) { show_notification("Failed to launch gpu-screen-recorder to take a screenshot", notification_error_timeout_seconds, mgl::Color(255, 0, 0), mgl::Color(255, 0, 0), NotificationType::SCREENSHOT); } + + if(config.screenshot_config.record_area_option == "portal") + hide_ui = true; } bool Overlay::update_compositor_texture(const Monitor &monitor) { diff --git a/src/gui/ScreenshotSettingsPage.cpp b/src/gui/ScreenshotSettingsPage.cpp index 27a94b0..c3560ad 100644 --- a/src/gui/ScreenshotSettingsPage.cpp +++ b/src/gui/ScreenshotSettingsPage.cpp @@ -120,7 +120,7 @@ namespace gsr { ll->add_widget(std::move(capture_target_list)); ll->add_widget(create_change_image_resolution_section()); - return std::make_unique("Record area", std::move(ll), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)); + return std::make_unique("Capture", std::move(ll), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)); } std::unique_ptr ScreenshotSettingsPage::create_image_quality_section() { diff --git a/src/gui/SettingsPage.cpp b/src/gui/SettingsPage.cpp index 26e7335..405ba28 100644 --- a/src/gui/SettingsPage.cpp +++ b/src/gui/SettingsPage.cpp @@ -183,7 +183,7 @@ namespace gsr { ll->add_widget(std::move(capture_target_list)); ll->add_widget(create_change_video_resolution_section()); - return std::make_unique("Record area", std::move(ll), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)); + return std::make_unique("Capture", std::move(ll), mgl::vec2f(settings_scrollable_page_ptr->get_inner_size().x, 0.0f)); } static bool audio_device_is_output(const std::string &audio_device_id) {