From 3b430ee962d34600bb5b6f58e94890fba8109f8e Mon Sep 17 00:00:00 2001 From: Mihir Lad Date: Wed, 22 Jul 2020 19:05:38 -0400 Subject: [PATCH] dwm: Rename layout token from %layout% to %symbol% This token name is more indicative of what the token will be replaced with. --- config.cmake | 2 +- src/modules/dwm.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config.cmake b/config.cmake index d2e494e6..f734763a 100644 --- a/config.cmake +++ b/config.cmake @@ -188,7 +188,7 @@ label-title-padding = 2 label-title-forefround = ${colors.primary} label-title-maxlen = 30 -label-layout = %layout% +label-layout = %symbol% label-layout-padding = 2 label-layout-foreground = #000 label-layout-background = ${colors.primary} diff --git a/src/modules/dwm.cpp b/src/modules/dwm.cpp index e567e2d0..251c4a1c 100644 --- a/src/modules/dwm.cpp +++ b/src/modules/dwm.cpp @@ -28,7 +28,8 @@ namespace modules { m_ipc = factory_util::unique(socket_path); // Load configuration - m_formatter->add(DEFAULT_FORMAT, DEFAULT_FORMAT_TAGS, {TAG_LABEL_TAGS, TAG_LABEL_LAYOUT, TAG_LABEL_FLOATING, TAG_LABEL_TITLE}); + m_formatter->add( + DEFAULT_FORMAT, DEFAULT_FORMAT_TAGS, {TAG_LABEL_TAGS, TAG_LABEL_LAYOUT, TAG_LABEL_FLOATING, TAG_LABEL_TITLE}); // Populate m_state_labels map with labels and their states if (m_formatter->has(TAG_LABEL_TAGS)) { @@ -47,7 +48,7 @@ namespace modules { m_seperator_label = load_optional_label(m_conf, name(), "label-separator", ""); if (m_formatter->has(TAG_LABEL_LAYOUT)) { - m_layout_label = load_optional_label(m_conf, name(), "label-layout", "%layout%"); + m_layout_label = load_optional_label(m_conf, name(), "label-layout", "%symbol%"); } if (m_formatter->has(TAG_LABEL_FLOATING)) { @@ -94,7 +95,7 @@ namespace modules { } // Initialize layout symbol - m_layout_label->replace_token("%layout%", m_bar_mon->layout.symbol.cur); + m_layout_label->replace_token("%symbol%", m_bar_mon->layout.symbol.cur); // This event is only needed to update the layout label m_ipc->on_layout_change = [this](const dwmipc::LayoutChangeEvent& ev) { on_layout_change(ev); }; m_ipc->subscribe(dwmipc::Event::LAYOUT_CHANGE); @@ -412,7 +413,7 @@ namespace modules { if (ev.monitor_num == m_bar_mon->num) { m_current_layout = find_layout(ev.new_address); m_layout_label->reset_tokens(); - m_layout_label->replace_token("%layout%", ev.new_symbol); + m_layout_label->replace_token("%symbol%", ev.new_symbol); } }