From 06a9f988780e5dbcf7786787d032b062f44df1c1 Mon Sep 17 00:00:00 2001 From: zjeffer <4633209+zjeffer@users.noreply.github.com> Date: Thu, 24 Aug 2023 21:19:20 +0200 Subject: [PATCH 1/2] hyprland/workspaces: Add "empty" icon and class --- src/modules/hyprland/workspaces.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/hyprland/workspaces.cpp b/src/modules/hyprland/workspaces.cpp index 9f46b823..04e4327d 100644 --- a/src/modules/hyprland/workspaces.cpp +++ b/src/modules/hyprland/workspaces.cpp @@ -328,7 +328,8 @@ void Workspace::update(const std::string &format, const std::string &icon) { auto style_context = button_.get_style_context(); add_or_remove_class(style_context, active(), "active"); add_or_remove_class(style_context, is_special(), "special"); - add_or_remove_class(style_context, is_empty(), "persistent"); + add_or_remove_class(style_context, is_empty(), "empty"); + add_or_remove_class(style_context, is_persistent(), "persistent"); add_or_remove_class(style_context, is_urgent(), "urgent"); label_.set_markup(fmt::format(fmt::runtime(format), fmt::arg("id", id()), @@ -394,6 +395,13 @@ std::string &Workspace::select_icon(std::map &icons_ma return named_icon_it->second; } + if (is_empty()) { + auto empty_icon_it = icons_map.find("empty"); + if (empty_icon_it != icons_map.end()) { + return empty_icon_it->second; + } + } + if (is_persistent()) { auto persistent_icon_it = icons_map.find("persistent"); if (persistent_icon_it != icons_map.end()) { From e163dd82168490b038e462e6c4623229bf09924f Mon Sep 17 00:00:00 2001 From: zjeffer <4633209+zjeffer@users.noreply.github.com> Date: Thu, 24 Aug 2023 22:51:06 +0200 Subject: [PATCH 2/2] hyprland/workspaces: update manpage --- man/waybar-hyprland-workspaces.5.scd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/man/waybar-hyprland-workspaces.5.scd b/man/waybar-hyprland-workspaces.5.scd index 6f138488..1bbbd385 100644 --- a/man/waybar-hyprland-workspaces.5.scd +++ b/man/waybar-hyprland-workspaces.5.scd @@ -46,7 +46,8 @@ Additional to workspace name matching, the following *format-icons* can be set. - *default*: Will be shown, when no string match is found. - *active*: Will be shown, when workspace is active - *special*: Will be shown on non-active special workspaces -- *persistent*: Will be shown on non-active persistent workspaces +- *empty*: Will be shown on empty persistent workspaces +- *persistent*: Will be shown on non-empty persistent workspaces # EXAMPLES @@ -74,6 +75,7 @@ Additional to workspace name matching, the following *format-icons* can be set. - *#workspaces* - *#workspaces button* - *#workspaces button.active* +- *#workspaces button.empty* - *#workspaces button.persistent* - *#workspaces button.special* - *#workspaces button.urgent*