mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
Idle inhibitor toggle no longer update all modules - a list of idle inhibitors is maintained on the Client.
This commit is contained in:
parent
188611a767
commit
aa4fc3dd29
@ -31,7 +31,6 @@ class Bar {
|
|||||||
|
|
||||||
auto toggle() -> void;
|
auto toggle() -> void;
|
||||||
void handleSignal(int);
|
void handleSignal(int);
|
||||||
void updateAll();
|
|
||||||
|
|
||||||
struct waybar_output *output;
|
struct waybar_output *output;
|
||||||
Json::Value config;
|
Json::Value config;
|
||||||
|
@ -21,8 +21,11 @@ class Client {
|
|||||||
struct wl_registry * registry = nullptr;
|
struct wl_registry * registry = nullptr;
|
||||||
struct zwlr_layer_shell_v1 * layer_shell = nullptr;
|
struct zwlr_layer_shell_v1 * layer_shell = nullptr;
|
||||||
struct zxdg_output_manager_v1 * xdg_output_manager = nullptr;
|
struct zxdg_output_manager_v1 * xdg_output_manager = nullptr;
|
||||||
|
|
||||||
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager = nullptr;
|
struct zwp_idle_inhibit_manager_v1 *idle_inhibit_manager = nullptr;
|
||||||
struct zwp_idle_inhibitor_v1* idle_inhibitor;
|
struct zwp_idle_inhibitor_v1* idle_inhibitor;
|
||||||
|
std::vector<waybar::AModule*> idle_inhibitor_modules;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<Bar>> bars;
|
std::vector<std::unique_ptr<Bar>> bars;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
12
src/bar.cpp
12
src/bar.cpp
@ -461,15 +461,3 @@ auto waybar::Bar::setupWidgets() -> void {
|
|||||||
right_.pack_end(*module, false, false);
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -10,6 +10,7 @@ waybar::modules::IdleInhibitor::IdleInhibitor(const std::string& id, const Bar&
|
|||||||
event_box_.add_events(Gdk::BUTTON_PRESS_MASK);
|
event_box_.add_events(Gdk::BUTTON_PRESS_MASK);
|
||||||
event_box_.signal_button_press_event().connect(
|
event_box_.signal_button_press_event().connect(
|
||||||
sigc::mem_fun(*this, &IdleInhibitor::handleToggle));
|
sigc::mem_fun(*this, &IdleInhibitor::handleToggle));
|
||||||
|
waybar::Client::inst()->idle_inhibitor_modules.push_back(this);
|
||||||
dp.emit();
|
dp.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,9 +58,11 @@ bool waybar::modules::IdleInhibitor::handleToggle(GdkEventButton* const& e) {
|
|||||||
click_param = status_;
|
click_param = status_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make all modules update
|
// Make all other idle inhibitor modules update
|
||||||
for (auto const& bar : waybar::Client::inst()->bars) {
|
for (auto const& module : waybar::Client::inst()->idle_inhibitor_modules) {
|
||||||
bar->updateAll();
|
if (module != this) {
|
||||||
|
module->update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ALabel::handleToggle(e);
|
ALabel::handleToggle(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user