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.
This commit is contained in:
Mihir Lad 2020-07-19 20:35:42 -04:00
parent ce74fae822
commit ee56fc48ab

View File

@ -85,8 +85,10 @@ namespace modules {
auto layouts = m_ipc->get_layouts(); auto layouts = m_ipc->get_layouts();
m_layout_label->replace_token("%layout%", m_monitors->at(m_bar_mon).layout.symbol.cur); 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_ipc->on_layout_change = [this](const dwmipc::LayoutChangeEvent& ev) {
if (ev.monitor_num == m_bar_mon) {
m_layout_label->reset_tokens(); m_layout_label->reset_tokens();
m_layout_label->replace_token("%layout%", ev.new_symbol); m_layout_label->replace_token("%layout%", ev.new_symbol);
}
}; };
} }