Remove (x11 applications only) for window title text on kde plasma wayland and hyprland

This commit is contained in:
dec05eba
2026-01-24 17:58:08 +01:00
parent ed671e9d7c
commit 3d673247a7
2 changed files with 20 additions and 4 deletions

View File

@@ -247,5 +247,7 @@ namespace gsr {
std::optional<GsrCamera> selected_camera;
std::optional<GsrCameraSetup> selected_camera_setup;
bool supports_window_title = false;
};
}

View File

@@ -10,8 +10,13 @@
#include "../../include/Theme.hpp"
#include "../../include/GsrInfo.hpp"
#include "../../include/Utils.hpp"
#include "mglpp/window/Window.hpp"
#include "mglpp/window/Event.hpp"
#include "../../include/WindowUtils.hpp"
#include <mglpp/window/Window.hpp>
#include <mglpp/window/Event.hpp>
extern "C" {
#include <mgl/mgl.h>
}
#include <algorithm>
#include <cmath>
@@ -46,6 +51,14 @@ namespace gsr {
application_audio = get_application_audio();
capture_options = get_supported_capture_options(*gsr_info);
mgl_context *context = mgl_get_context();
Display *display = (Display*)context->connection;
const std::string wm_name = get_window_manager_name(display);
const bool is_hyprland = wm_name.find("Hyprland") != std::string::npos;
const bool is_kwin = wm_name == "KWin";
supports_window_title = gsr_info->system_info.display_server == DisplayServer::X11 || is_hyprland || is_kwin;
auto content_page = std::make_unique<GsrPage>(settings_page_type_to_title_text(type), "Settings");
content_page->add_button("Back", "back", get_color_theme().page_bg_color);
content_page->on_click = [page_stack](const std::string &id) {
@@ -1113,6 +1126,7 @@ namespace gsr {
}
std::unique_ptr<RadioButton> SettingsPage::create_start_replay_automatically() {
// TODO: Support kde plasma wayland and hyprland (same ones that support getting window title)
char fullscreen_text[256];
snprintf(fullscreen_text, sizeof(fullscreen_text), "Turn on replay when starting a fullscreen application%s", gsr_info->system_info.display_server == DisplayServer::X11 ? "" : " (X11 applications only)");
@@ -1127,7 +1141,7 @@ namespace gsr {
std::unique_ptr<CheckBox> SettingsPage::create_save_replay_in_game_folder() {
char text[256];
snprintf(text, sizeof(text), "Save video in a folder with the name of the game%s", gsr_info->system_info.display_server == DisplayServer::X11 ? "" : " (X11 applications only)");
snprintf(text, sizeof(text), "Save video in a folder with the name of the game%s", supports_window_title ? "" : " (X11 applications only)");
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, text);
save_replay_in_game_folder_ptr = checkbox.get();
return checkbox;
@@ -1280,7 +1294,7 @@ namespace gsr {
std::unique_ptr<CheckBox> SettingsPage::create_save_recording_in_game_folder() {
char text[256];
snprintf(text, sizeof(text), "Save video in a folder with the name of the game%s", gsr_info->system_info.display_server == DisplayServer::X11 ? "" : " (X11 applications only)");
snprintf(text, sizeof(text), "Save video in a folder with the name of the game%s", supports_window_title ? "" : " (X11 applications only)");
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, text);
save_recording_in_game_folder_ptr = checkbox.get();
return checkbox;