mirror of
https://github.com/rad4day/Waybar.git
synced 2025-07-13 22:52:30 +02:00
modules: Set style-context on button
Fixes issue where the class parameters in style.css would have no effect. The CSS now references the GtkButton instead of the GtkLabel. Removing all style-classes from the custom module GtkButton however removes any properties set via style.css. Thus, the default classes 'flat' and 'text-button' are added on every update of these modules.
This commit is contained in:
@ -143,14 +143,16 @@ auto waybar::modules::Custom::update() -> void {
|
||||
}
|
||||
}
|
||||
}
|
||||
auto classes = label_->get_style_context()->list_classes();
|
||||
auto classes = button_.get_style_context()->list_classes();
|
||||
for (auto const& c : classes) {
|
||||
if (c == id_) continue;
|
||||
label_->get_style_context()->remove_class(c);
|
||||
button_.get_style_context()->remove_class(c);
|
||||
}
|
||||
for (auto const& c : class_) {
|
||||
label_->get_style_context()->add_class(c);
|
||||
button_.get_style_context()->add_class(c);
|
||||
}
|
||||
button_.get_style_context()->add_class("flat");
|
||||
button_.get_style_context()->add_class("text-button");
|
||||
event_box_.show();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user