diff --git a/include/modules/xworkspaces.hpp b/include/modules/xworkspaces.hpp index 191f7f4e..cd6522e7 100644 --- a/include/modules/xworkspaces.hpp +++ b/include/modules/xworkspaces.hpp @@ -92,6 +92,7 @@ namespace modules { vector m_desktop_names; unsigned int m_current_desktop; + string m_current_desktop_name; vector m_clientlist; vector> m_viewports; diff --git a/src/modules/xworkspaces.cpp b/src/modules/xworkspaces.cpp index 22587a1f..da94264b 100644 --- a/src/modules/xworkspaces.cpp +++ b/src/modules/xworkspaces.cpp @@ -83,6 +83,7 @@ namespace modules { // Get desktop details m_desktop_names = get_desktop_names(); m_current_desktop = ewmh_util::get_current_desktop(); + m_current_desktop_name = m_desktop_names[m_current_desktop]; rebuild_desktops(); rebuild_desktop_states(); @@ -103,6 +104,7 @@ namespace modules { rebuild_desktop_states(); } else if (evt->atom == m_ewmh->_NET_CURRENT_DESKTOP) { m_current_desktop = ewmh_util::get_current_desktop(); + m_current_desktop_name = m_desktop_names[m_current_desktop]; rebuild_desktop_states(); } else if (evt->atom == WM_HINTS) { if (icccm_util::get_wm_urgency(m_connection, evt->window)) { @@ -209,7 +211,7 @@ namespace modules { void xworkspaces_module::rebuild_desktop_states() { for (auto&& v : m_viewports) { for (auto&& d : v->desktops) { - if (d->index == m_current_desktop) { + if (m_desktop_names[d->index] == m_current_desktop_name) { d->state = desktop_state::ACTIVE; } else { d->state = desktop_state::EMPTY;