dwl/tags: add hide-vacant option

This commit is contained in:
Alex Denes
2025-02-08 03:53:28 +00:00
parent c32d5e3883
commit 807208cba8
3 changed files with 16 additions and 0 deletions
+10
View File
@@ -94,7 +94,11 @@ Tags::Tags(const std::string &id, const waybar::Bar &bar, const Json::Value &con
seat_{nullptr},
bar_(bar),
box_{bar.orientation, 0},
hide_vacant_(false),
output_status_{nullptr} {
if (config_["hide-vacant"].asBool()) {
hide_vacant_ = config_["hide-vacant"].asBool();
}
struct wl_display *display = Client::inst()->wl_display;
struct wl_registry *registry = wl_display_get_registry(display);
@@ -198,6 +202,12 @@ void Tags::handle_view_tags(uint32_t tag, uint32_t state, uint32_t clients, uint
} else {
button.get_style_context()->remove_class("urgent");
}
if (hide_vacant_ && !clients && !(state & TAG_ACTIVE)) {
button.set_visible(false);
} else {
button.set_visible(true);
}
}
} /* namespace waybar::modules::dwl */