mirror of
https://github.com/rad4day/Waybar.git
synced 2025-07-14 23:22:31 +02:00
modules: Revert button to label
This commit is contained in:
@ -98,7 +98,7 @@ auto getInhibitors(const Json::Value& config) -> std::string {
|
||||
namespace waybar::modules {
|
||||
|
||||
Inhibitor::Inhibitor(const std::string& id, const Bar& bar, const Json::Value& config)
|
||||
: AButton(config, "inhibitor", id, "{status}", true),
|
||||
: ALabel(config, "inhibitor", id, "{status}", true),
|
||||
dbus_(::dbus()),
|
||||
inhibitors_(::getInhibitors(config)) {
|
||||
event_box_.add_events(Gdk::BUTTON_PRESS_MASK);
|
||||
@ -117,16 +117,16 @@ auto Inhibitor::activated() -> bool { return handle_ != -1; }
|
||||
auto Inhibitor::update() -> void {
|
||||
std::string status_text = activated() ? "activated" : "deactivated";
|
||||
|
||||
button_.get_style_context()->remove_class(activated() ? "deactivated" : "activated");
|
||||
label_->set_markup(fmt::format(format_, fmt::arg("status", status_text),
|
||||
fmt::arg("icon", getIcon(0, status_text))));
|
||||
button_.get_style_context()->add_class(status_text);
|
||||
label_.get_style_context()->remove_class(activated() ? "deactivated" : "activated");
|
||||
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);
|
||||
|
||||
if (tooltipEnabled()) {
|
||||
button_.set_tooltip_text(status_text);
|
||||
label_.set_tooltip_text(status_text);
|
||||
}
|
||||
|
||||
return AButton::update();
|
||||
return ALabel::update();
|
||||
}
|
||||
|
||||
auto Inhibitor::handleToggle(GdkEventButton* const& e) -> bool {
|
||||
@ -142,7 +142,7 @@ auto Inhibitor::handleToggle(GdkEventButton* const& e) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
return AButton::handleToggle(e);
|
||||
return ALabel::handleToggle(e);
|
||||
}
|
||||
|
||||
} // namespace waybar::modules
|
||||
|
Reference in New Issue
Block a user