From ee56fc48abc9fbadcf11952fe498b451a6f46b9d Mon Sep 17 00:00:00 2001 From: Mihir Lad Date: Sun, 19 Jul 2020 20:35:42 -0400 Subject: [PATCH] dwm: Only change layout symbol for bar monitor Since the layout_change_event is raised for all monitors, check to make sure the monitor of the bar matches the monitor on which the layout was changed before setting the layout label. --- src/modules/dwm.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/dwm.cpp b/src/modules/dwm.cpp index 181d4382..46628eb8 100644 --- a/src/modules/dwm.cpp +++ b/src/modules/dwm.cpp @@ -85,8 +85,10 @@ namespace modules { auto layouts = m_ipc->get_layouts(); m_layout_label->replace_token("%layout%", m_monitors->at(m_bar_mon).layout.symbol.cur); m_ipc->on_layout_change = [this](const dwmipc::LayoutChangeEvent& ev) { - m_layout_label->reset_tokens(); - m_layout_label->replace_token("%layout%", ev.new_symbol); + if (ev.monitor_num == m_bar_mon) { + m_layout_label->reset_tokens(); + m_layout_label->replace_token("%layout%", ev.new_symbol); + } }; }