Added KWin workaround to get current window title

This commit is contained in:
Andrew
2026-01-21 23:58:31 +03:00
committed by dec05eba
parent 23b1526092
commit 00ceaa989d
6 changed files with 401 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
#include "../include/gui/ScreenshotSettingsPage.hpp"
#include "../include/gui/GlobalSettingsPage.hpp"
#include "../include/gui/Utils.hpp"
#include "../include/KwinWorkaround.hpp"
#include "../include/HyprlandWorkaround.hpp"
#include "../include/gui/PageStack.hpp"
#include "../include/WindowUtils.hpp"
@@ -553,6 +554,10 @@ namespace gsr {
if (get_window_manager_name(x11_dpy).find("Hyprland") != std::string::npos) {
start_hyprland_listener_thread();
}
if (get_window_manager_name(x11_dpy) == "KWin") {
start_kwin_helper_thread();
}
}
update_led_indicator_after_settings_change();
@@ -1974,10 +1979,16 @@ namespace gsr {
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";
const bool inside_flatpak = getenv("FLATPAK_ID") != NULL;
if (is_hyprland) {
focused_window_name = get_current_hyprland_window_title();
}
else if (is_kwin && !inside_flatpak) {
focused_window_name = get_current_kwin_window_title();
}
else {
if(focused_window_name.empty())
focused_window_name = get_focused_window_name(display, WindowCaptureType::FOCUSED, false);