1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-10-27 05:23:39 -04:00

refactor(bspwm): Cleanup

This commit is contained in:
Michael Carlberg 2016-10-11 16:09:18 +02:00
parent b7f9cb2820
commit 257b73d589

View file

@ -43,9 +43,19 @@ namespace modules {
public:
using event_module::event_module;
~bspwm_module() {
if (m_subscriber)
m_subscriber->disconnect();
}
void setup() {
m_monitor = m_bar.monitor->name;
m_log.trace("%s: Primary monitor '%s'", name(), m_monitor);
m_subscriber = bspwm_util::make_subscriber();
// Add formats and create components {{{
m_formatter->add(DEFAULT_FORMAT, TAG_LABEL_STATE, {TAG_LABEL_STATE}, {TAG_LABEL_MODE});
if (m_formatter->has(TAG_LABEL_STATE)) {
@ -78,8 +88,7 @@ namespace modules {
get_optional_config_label(m_conf, name(), "label-private")));
}
m_monitor = m_bar.monitor->name;
m_log.trace("%s: Primary monitor '%s'", name(), m_monitor);
// }}}
m_icons = iconset_t{new iconset()};
m_icons->add(
@ -93,15 +102,6 @@ namespace modules {
}
}
void start() {
event_module::start();
}
void stop() {
event_module::stop();
m_subscriber && m_subscriber->disconnect();
}
bool has_event() {
if (m_subscriber->poll(POLLHUP, 0)) {
m_log.warn("%s: Reconnecting to socket...", name());