From 77c7b91b40e2fbc1f31b4ca479c5aba9ed4f4f54 Mon Sep 17 00:00:00 2001 From: alttabber Date: Tue, 13 Feb 2024 11:42:09 +0100 Subject: [PATCH] Add style classes for hyprland/submap --- man/waybar-hyprland-submap.5.scd | 1 + src/modules/hyprland/submap.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/man/waybar-hyprland-submap.5.scd b/man/waybar-hyprland-submap.5.scd index 3f8d6280..0dc0b11a 100644 --- a/man/waybar-hyprland-submap.5.scd +++ b/man/waybar-hyprland-submap.5.scd @@ -80,3 +80,4 @@ Addressed by *hyprland/submap* # STYLE - *#submap* +- *#submap.* diff --git a/src/modules/hyprland/submap.cpp b/src/modules/hyprland/submap.cpp index d1d9a116..ce27fc9a 100644 --- a/src/modules/hyprland/submap.cpp +++ b/src/modules/hyprland/submap.cpp @@ -54,8 +54,16 @@ void Submap::onEvent(const std::string& ev) { auto submapName = ev.substr(ev.find_last_of('>') + 1); submapName = waybar::util::sanitize_string(submapName); + if (!submap_.empty()){ + label_.get_style_context()->remove_class(submap_); + } + submap_ = submapName; + label_.get_style_context()->add_class(submap_); + + + spdlog::debug("hyprland submap onevent with {}", submap_); dp.emit();