mirror of
https://github.com/rad4day/Waybar.git
synced 2025-07-14 23:22:31 +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:
@ -309,8 +309,8 @@ auto waybar::modules::Network::update() -> void {
|
||||
|
||||
if (!alt_) {
|
||||
auto state = getNetworkState();
|
||||
if (!state_.empty() && label_->get_style_context()->has_class(state_)) {
|
||||
label_->get_style_context()->remove_class(state_);
|
||||
if (!state_.empty() && button_.get_style_context()->has_class(state_)) {
|
||||
button_.get_style_context()->remove_class(state_);
|
||||
}
|
||||
if (config_["format-" + state].isString()) {
|
||||
default_format_ = config_["format-" + state].asString();
|
||||
@ -322,8 +322,8 @@ auto waybar::modules::Network::update() -> void {
|
||||
if (config_["tooltip-format-" + state].isString()) {
|
||||
tooltip_format = config_["tooltip-format-" + state].asString();
|
||||
}
|
||||
if (!label_->get_style_context()->has_class(state)) {
|
||||
label_->get_style_context()->add_class(state);
|
||||
if (!button_.get_style_context()->has_class(state)) {
|
||||
button_.get_style_context()->add_class(state);
|
||||
}
|
||||
format_ = default_format_;
|
||||
state_ = state;
|
||||
|
Reference in New Issue
Block a user