feat: hide module if empty
parent
3043d42a89
commit
e235f48245
|
@ -161,6 +161,7 @@ At the time of writing, the experimental features of BlueZ need to be turned on,
|
||||||
"bluetooth": {
|
"bluetooth": {
|
||||||
// "controller": "controller1", // specify the alias of the controller if there are more than 1 on the system
|
// "controller": "controller1", // specify the alias of the controller if there are more than 1 on the system
|
||||||
"format": " {status}",
|
"format": " {status}",
|
||||||
|
"format-disabled": "", // an empty format will hide the module
|
||||||
"format-connected": " {num_connections} connected",
|
"format-connected": " {num_connections} connected",
|
||||||
"tooltip-format": "{controller_alias}\\t{controller_address}",
|
"tooltip-format": "{controller_alias}\\t{controller_address}",
|
||||||
"tooltip-format-connected": "{controller_alias}\\t{controller_address}\\n\\n{device_enumerate}",
|
"tooltip-format-connected": "{controller_alias}\\t{controller_address}\\n\\n{device_enumerate}",
|
||||||
|
|
|
@ -171,6 +171,8 @@ auto waybar::modules::Bluetooth::update() -> void {
|
||||||
tooltip_format = config_["tooltip-format"].asString();
|
tooltip_format = config_["tooltip-format"].asString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
format_.empty() ? event_box_.hide() : event_box_.show();
|
||||||
|
|
||||||
auto update_style_context = [this](const std::string& style_class, bool in_next_state) {
|
auto update_style_context = [this](const std::string& style_class, bool in_next_state) {
|
||||||
if (in_next_state && !label_.get_style_context()->has_class(style_class)) {
|
if (in_next_state && !label_.get_style_context()->has_class(style_class)) {
|
||||||
label_.get_style_context()->add_class(style_class);
|
label_.get_style_context()->add_class(style_class);
|
||||||
|
|
Loading…
Reference in New Issue