From 0846ecf3bc4d2b0242fe2487db12ead381054859 Mon Sep 17 00:00:00 2001 From: Maksim Karelov Date: Mon, 5 Aug 2024 01:49:20 +0700 Subject: [PATCH] Add dwl/tags option to show only active tags --- man/waybar-dwl-tags.5.scd | 5 +++++ src/modules/dwl/tags.cpp | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/man/waybar-dwl-tags.5.scd b/man/waybar-dwl-tags.5.scd index 07c94be9a..05dea664d 100644 --- a/man/waybar-dwl-tags.5.scd +++ b/man/waybar-dwl-tags.5.scd @@ -26,6 +26,11 @@ Addressed by *dwl/tags* default: false ++ If set to false, you can left-click to set focused tag. Right-click to toggle tag focus. If set to true this behaviour is disabled. +*show-only-viable*: ++ + typeof: bool ++ + default: false ++ + If set to true, only active (focused, urgent or with clients) tags will be displayed. + # EXAMPLE ``` diff --git a/src/modules/dwl/tags.cpp b/src/modules/dwl/tags.cpp index 085b82246..4e67c3e8a 100644 --- a/src/modules/dwl/tags.cpp +++ b/src/modules/dwl/tags.cpp @@ -198,6 +198,15 @@ void Tags::handle_view_tags(uint32_t tag, uint32_t state, uint32_t clients, uint } else { button.get_style_context()->remove_class("urgent"); } + + const bool show_only_viable = config_["show-only-viable"].asBool(); + if (show_only_viable) { + if (clients > 0 || state & (TAG_ACTIVE | TAG_URGENT)) { + button.show(); + } else { + button.hide(); + } + } } } /* namespace waybar::modules::dwl */