Idle inhibitor toggle no longer update all modules - a list of idle inhibitors is maintained on the Client.

This commit is contained in:
Jordan Leppert
2020-10-31 17:30:25 +00:00
parent 188611a767
commit aa4fc3dd29
4 changed files with 9 additions and 16 deletions

View File

@ -461,15 +461,3 @@ auto waybar::Bar::setupWidgets() -> void {
right_.pack_end(*module, false, false);
}
}
void waybar::Bar::updateAll() {
for (auto const& module : modules_left_) {
module->update();
}
for (auto const& module : modules_center_) {
module->update();
}
for (auto const& module : modules_right_) {
module->update();
}
}

View File

@ -10,6 +10,7 @@ waybar::modules::IdleInhibitor::IdleInhibitor(const std::string& id, const Bar&
event_box_.add_events(Gdk::BUTTON_PRESS_MASK);
event_box_.signal_button_press_event().connect(
sigc::mem_fun(*this, &IdleInhibitor::handleToggle));
waybar::Client::inst()->idle_inhibitor_modules.push_back(this);
dp.emit();
}
@ -57,9 +58,11 @@ bool waybar::modules::IdleInhibitor::handleToggle(GdkEventButton* const& e) {
click_param = status_;
}
// Make all modules update
for (auto const& bar : waybar::Client::inst()->bars) {
bar->updateAll();
// Make all other idle inhibitor modules update
for (auto const& module : waybar::Client::inst()->idle_inhibitor_modules) {
if (module != this) {
module->update();
}
}
ALabel::handleToggle(e);