From e8b022c0969a5d73326b45b9645c2c06dfcbf9fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20W=C3=B6lfel?= Date: Tue, 12 Apr 2022 10:26:21 +0200 Subject: [PATCH] Add disabled bluetooth style Allow to set a different style if the bluetooth adapter is disabled. --- man/waybar-bluetooth.5.scd | 1 + src/modules/bluetooth.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/man/waybar-bluetooth.5.scd b/man/waybar-bluetooth.5.scd index d4ecb1d..1797e80 100644 --- a/man/waybar-bluetooth.5.scd +++ b/man/waybar-bluetooth.5.scd @@ -94,3 +94,4 @@ Addressed by *bluetooth* # STYLE - *#bluetooth* +- *#bluetooth.disabled* diff --git a/src/modules/bluetooth.cpp b/src/modules/bluetooth.cpp index 1540c05..371bc7d 100644 --- a/src/modules/bluetooth.cpp +++ b/src/modules/bluetooth.cpp @@ -12,6 +12,11 @@ auto waybar::modules::Bluetooth::update() -> void { label_.set_markup( fmt::format(format_, fmt::arg("status", status), fmt::arg("icon", getIcon(0, status)))); + if (status == "disabled") { + label_.get_style_context()->add_class("disabled"); + } else { + label_.get_style_context()->remove_class("disabled"); + } if (tooltipEnabled()) { if (config_["tooltip-format"].isString()) {