From ce74fae822168b339969eb3347a1eed7500cd96a Mon Sep 17 00:00:00 2001 From: Mihir Lad Date: Sun, 19 Jul 2020 20:32:10 -0400 Subject: [PATCH] dwm: Get and set title on module startup When the module starts up, the title is not set until the client focus changes. This commit fixes that by getting the window title of the currently selected client in the module constructor. --- src/modules/dwm.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/modules/dwm.cpp b/src/modules/dwm.cpp index 4cdb7652..181d4382 100644 --- a/src/modules/dwm.cpp +++ b/src/modules/dwm.cpp @@ -62,6 +62,15 @@ namespace modules { [](dwmipc::Monitor& m1, dwmipc::Monitor& m2) { return m1.num < m2.num; }); update_monitor_ref(); + auto selected_client = m_monitors->at(m_bar_mon).clients.selected; + std::shared_ptr c; + if (selected_client != 0) { + c = m_ipc->get_client(selected_client); + } + + m_title_label->reset_tokens(); + m_title_label->replace_token("%title%", c->name); + auto tags = m_ipc->get_tags(); // m_tags.resize(tags->size());