mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01: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:
@ -44,13 +44,13 @@ waybar::modules::IdleInhibitor::~IdleInhibitor() {
|
||||
auto waybar::modules::IdleInhibitor::update() -> void {
|
||||
// Check status
|
||||
if (status) {
|
||||
label_->get_style_context()->remove_class("deactivated");
|
||||
button_.get_style_context()->remove_class("deactivated");
|
||||
if (idle_inhibitor_ == nullptr) {
|
||||
idle_inhibitor_ = zwp_idle_inhibit_manager_v1_create_inhibitor(
|
||||
waybar::Client::inst()->idle_inhibit_manager, bar_.surface);
|
||||
}
|
||||
} else {
|
||||
label_->get_style_context()->remove_class("activated");
|
||||
button_.get_style_context()->remove_class("activated");
|
||||
if (idle_inhibitor_ != nullptr) {
|
||||
zwp_idle_inhibitor_v1_destroy(idle_inhibitor_);
|
||||
idle_inhibitor_ = nullptr;
|
||||
@ -60,7 +60,7 @@ auto waybar::modules::IdleInhibitor::update() -> void {
|
||||
std::string status_text = status ? "activated" : "deactivated";
|
||||
label_->set_markup(fmt::format(format_, fmt::arg("status", status_text),
|
||||
fmt::arg("icon", getIcon(0, status_text))));
|
||||
label_->get_style_context()->add_class(status_text);
|
||||
button_.get_style_context()->add_class(status_text);
|
||||
if (tooltipEnabled()) {
|
||||
label_->set_tooltip_markup(
|
||||
status ? fmt::format(config_["tooltip-format-activated"].isString()
|
||||
|
Reference in New Issue
Block a user