refactor(bspwm): Cleanup
This commit is contained in:
parent
b7f9cb2820
commit
257b73d589
@ -43,9 +43,19 @@ namespace modules {
|
|||||||
public:
|
public:
|
||||||
using event_module::event_module;
|
using event_module::event_module;
|
||||||
|
|
||||||
|
~bspwm_module() {
|
||||||
|
if (m_subscriber)
|
||||||
|
m_subscriber->disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
m_monitor = m_bar.monitor->name;
|
||||||
|
m_log.trace("%s: Primary monitor '%s'", name(), m_monitor);
|
||||||
|
|
||||||
m_subscriber = bspwm_util::make_subscriber();
|
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});
|
m_formatter->add(DEFAULT_FORMAT, TAG_LABEL_STATE, {TAG_LABEL_STATE}, {TAG_LABEL_MODE});
|
||||||
|
|
||||||
if (m_formatter->has(TAG_LABEL_STATE)) {
|
if (m_formatter->has(TAG_LABEL_STATE)) {
|
||||||
@ -78,8 +88,7 @@ namespace modules {
|
|||||||
get_optional_config_label(m_conf, name(), "label-private")));
|
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 = iconset_t{new iconset()};
|
||||||
m_icons->add(
|
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() {
|
bool has_event() {
|
||||||
if (m_subscriber->poll(POLLHUP, 0)) {
|
if (m_subscriber->poll(POLLHUP, 0)) {
|
||||||
m_log.warn("%s: Reconnecting to socket...", name());
|
m_log.warn("%s: Reconnecting to socket...", name());
|
||||||
|
Loading…
Reference in New Issue
Block a user