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.
This commit is contained in:
Mihir Lad 2020-07-19 20:32:10 -04:00
parent 8e5b5258e2
commit ce74fae822

View File

@ -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<dwmipc::Client> 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());