xwindow: Also listen for WM_NAME changes

This commit is contained in:
patrick96 2022-09-19 22:45:31 +02:00 committed by Patrick Ziegler
parent 918bc212ee
commit 3da2662022
3 changed files with 7 additions and 5 deletions

View File

@ -10,7 +10,7 @@ struct cached_atom {
xcb_atom_t& atom;
};
extern std::array<cached_atom, 36> ATOMS;
extern std::array<cached_atom, 37> 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;

View File

@ -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;

View File

@ -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<cached_atom, 36> ATOMS = {{
std::array<cached_atom, 37> ATOMS = {{
{"_NET_SUPPORTED", _NET_SUPPORTED},
{"_NET_CURRENT_DESKTOP", _NET_CURRENT_DESKTOP},
{"_NET_ACTIVE_WINDOW", _NET_ACTIVE_WINDOW},
@ -78,5 +79,6 @@ std::array<cached_atom, 36> ATOMS = {{
{"_COMPTON_SHADOW", _COMPTON_SHADOW},
{"_NET_WM_WINDOW_OPACITY", _NET_WM_WINDOW_OPACITY},
{"WM_HINTS", WM_HINTS},
{"WM_NAME", WM_NAME},
}};
// clang-format on