From 3da26620222248bcf3252c039f1763869d399782 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Mon, 19 Sep 2022 22:45:31 +0200
Subject: [PATCH] xwindow: Also listen for WM_NAME changes
---
include/x11/atoms.hpp | 3 ++-
src/modules/xwindow.cpp | 5 ++---
src/x11/atoms.cpp | 4 +++-
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/x11/atoms.hpp b/include/x11/atoms.hpp
index ef42c1a6..f547710b 100644
--- a/include/x11/atoms.hpp
+++ b/include/x11/atoms.hpp
@@ -10,7 +10,7 @@ struct cached_atom {
xcb_atom_t& atom;
};
-extern std::array ATOMS;
+extern std::array ATOMS;
extern xcb_atom_t _NET_SUPPORTED;
extern xcb_atom_t _NET_CURRENT_DESKTOP;
@@ -48,3 +48,4 @@ extern xcb_atom_t ESETROOT_PMAP_ID;
extern xcb_atom_t _COMPTON_SHADOW;
extern xcb_atom_t _NET_WM_WINDOW_OPACITY;
extern xcb_atom_t WM_HINTS;
+extern xcb_atom_t WM_NAME;
diff --git a/src/modules/xwindow.cpp b/src/modules/xwindow.cpp
index 80383ce3..6deae450 100644
--- a/src/modules/xwindow.cpp
+++ b/src/modules/xwindow.cpp
@@ -42,6 +42,7 @@ namespace modules {
* Get the title by returning the first non-empty value of:
* _NET_WM_NAME
* _NET_WM_VISIBLE_NAME
+ * WM_NAME
*/
string active_window::title() const {
string title;
@@ -87,9 +88,7 @@ namespace modules {
update(true);
} else if (evt->atom == _NET_CURRENT_DESKTOP) {
update(true);
- } else if (evt->atom == _NET_WM_VISIBLE_NAME) {
- update();
- } else if (evt->atom == _NET_WM_NAME) {
+ } else if (evt->atom == _NET_WM_NAME || evt->atom == _NET_WM_VISIBLE_NAME || evt->atom == WM_NAME) {
update();
} else {
return;
diff --git a/src/x11/atoms.cpp b/src/x11/atoms.cpp
index 18641541..859c187e 100644
--- a/src/x11/atoms.cpp
+++ b/src/x11/atoms.cpp
@@ -39,9 +39,10 @@ xcb_atom_t ESETROOT_PMAP_ID;
xcb_atom_t _COMPTON_SHADOW;
xcb_atom_t _NET_WM_WINDOW_OPACITY;
xcb_atom_t WM_HINTS;
+xcb_atom_t WM_NAME;
// clang-format off
-std::array ATOMS = {{
+std::array ATOMS = {{
{"_NET_SUPPORTED", _NET_SUPPORTED},
{"_NET_CURRENT_DESKTOP", _NET_CURRENT_DESKTOP},
{"_NET_ACTIVE_WINDOW", _NET_ACTIVE_WINDOW},
@@ -78,5 +79,6 @@ std::array ATOMS = {{
{"_COMPTON_SHADOW", _COMPTON_SHADOW},
{"_NET_WM_WINDOW_OPACITY", _NET_WM_WINDOW_OPACITY},
{"WM_HINTS", WM_HINTS},
+ {"WM_NAME", WM_NAME},
}};
// clang-format on