From bfcb936d87cb7dade0cd4153467f90000a7b1104 Mon Sep 17 00:00:00 2001 From: loserMcloser Date: Wed, 11 May 2022 00:44:57 -0600 Subject: [PATCH] Add classes to individual keyboard state labels --- man/waybar-keyboard-state.5.scd | 7 ++++++- src/modules/keyboard_state.cpp | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/man/waybar-keyboard-state.5.scd b/man/waybar-keyboard-state.5.scd index 94db07d4..905a321f 100644 --- a/man/waybar-keyboard-state.5.scd +++ b/man/waybar-keyboard-state.5.scd @@ -79,4 +79,9 @@ The following *format-icons* can be set. - *#keyboard-state* - *#keyboard-state label* - *#keyboard-state label.locked* - +- *#keyboard-state label.numlock* +- *#keyboard-state label.numlock.locked* +- *#keyboard-state label.capslock* +- *#keyboard-state label.capslock.locked* +- *#keyboard-state label.scrolllock* +- *#keyboard-state label.scrolllock.locked* diff --git a/src/modules/keyboard_state.cpp b/src/modules/keyboard_state.cpp index 734fd7f4..38faacd6 100644 --- a/src/modules/keyboard_state.cpp +++ b/src/modules/keyboard_state.cpp @@ -103,12 +103,15 @@ waybar::modules::KeyboardState::KeyboardState(const std::string& id, const Bar& dev_(nullptr) { box_.set_name("keyboard-state"); if (config_["numlock"].asBool()) { + numlock_label_.get_style_context()->add_class("numlock"); box_.pack_end(numlock_label_, false, false, 0); } if (config_["capslock"].asBool()) { + capslock_label_.get_style_context()->add_class("capslock"); box_.pack_end(capslock_label_, false, false, 0); } if (config_["scrolllock"].asBool()) { + scrolllock_label_.get_style_context()->add_class("scrolllock"); box_.pack_end(scrolllock_label_, false, false, 0); } if (!id.empty()) {