Prefer keyboard-state over keyboard_state

This commit is contained in:
Grant Moyer 2021-07-23 09:45:07 -04:00
parent 311c5779ea
commit 88a5f713ed
5 changed files with 14 additions and 14 deletions

View File

@ -2,11 +2,11 @@ waybar-keyboard-state(5)
# NAME # NAME
waybar - keyboard_state module waybar - keyboard-state module
# DESCRIPTION # DESCRIPTION
The *keyboard_state* module displays the state of number lock, caps lock, and scroll lock. The *keyboard-state* module displays the state of number lock, caps lock, and scroll lock.
# CONFIGURATION # CONFIGURATION
@ -61,7 +61,7 @@ The following *format-icons* can be set.
# EXAMPLE: # EXAMPLE:
``` ```
"keyboard_state": { "keyboard-state": {
"numlock": true, "numlock": true,
"capslock": true, "capslock": true,
"format": "{name} {icon}", "format": "{name} {icon}",
@ -74,7 +74,7 @@ The following *format-icons* can be set.
# STYLE # STYLE
- *#keyboard_state* - *#keyboard-state*
- *#keyboard_state label* - *#keyboard-state label*
- *#keyboard_state label.locked* - *#keyboard-state label.locked*

View File

@ -6,7 +6,7 @@
// Choose the order of the modules // Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "custom/media"], "modules-left": ["sway/workspaces", "sway/mode", "custom/media"],
"modules-center": ["sway/window"], "modules-center": ["sway/window"],
"modules-right": ["mpd", "idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "keyboard_state", "sway/language", "battery", "battery#bat2", "clock", "tray"], "modules-right": ["mpd", "idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "keyboard-state", "sway/language", "battery", "battery#bat2", "clock", "tray"],
// Modules configuration // Modules configuration
// "sway/workspaces": { // "sway/workspaces": {
// "disable-scroll": true, // "disable-scroll": true,
@ -23,7 +23,7 @@
// "default": "" // "default": ""
// } // }
// }, // },
"keyboard_state": { "keyboard-state": {
"numlock": true, "numlock": true,
"capslock": true, "capslock": true,
"format": "{name} {icon}", "format": "{name} {icon}",

View File

@ -229,7 +229,7 @@ label:focus {
min-width: 16px; min-width: 16px;
} }
#keyboard_state { #keyboard-state {
background: #97e1ad; background: #97e1ad;
color: #000000; color: #000000;
padding: 0 0px; padding: 0 0px;
@ -237,10 +237,10 @@ label:focus {
min-width: 16px; min-width: 16px;
} }
#keyboard_state > label { #keyboard-state > label {
padding: 0 5px; padding: 0 5px;
} }
#keyboard_state > label.locked { #keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
} }

View File

@ -71,7 +71,7 @@ waybar::AModule* waybar::Factory::makeModule(const std::string& name) const {
} }
#endif #endif
#ifdef HAVE_LIBEVDEV #ifdef HAVE_LIBEVDEV
if (ref == "keyboard_state") { if (ref == "keyboard-state") {
return new waybar::modules::KeyboardState(id, bar_, config_[name]); return new waybar::modules::KeyboardState(id, bar_, config_[name]);
} }
#endif #endif

View File

@ -9,7 +9,7 @@ extern "C" {
} }
waybar::modules::KeyboardState::KeyboardState(const std::string& id, const Bar& bar, const Json::Value& config) waybar::modules::KeyboardState::KeyboardState(const std::string& id, const Bar& bar, const Json::Value& config)
: AModule(config, "keyboard_state", id, false, !config["disable-scroll"].asBool()), : AModule(config, "keyboard-state", id, false, !config["disable-scroll"].asBool()),
box_(bar.vertical ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL, 0), box_(bar.vertical ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL, 0),
numlock_label_(""), numlock_label_(""),
capslock_label_(""), capslock_label_(""),
@ -31,7 +31,7 @@ waybar::modules::KeyboardState::KeyboardState(const std::string& id, const Bar&
: "unlocked"), : "unlocked"),
fd_(0), fd_(0),
dev_(nullptr) { dev_(nullptr) {
box_.set_name("keyboard_state"); box_.set_name("keyboard-state");
if (config_["numlock"].asBool()) { if (config_["numlock"].asBool()) {
box_.pack_end(numlock_label_, false, false, 0); box_.pack_end(numlock_label_, false, false, 0);
} }