mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-11-04 09:42:42 +01:00 
			
		
		
		
	Prefer keyboard-state over keyboard_state
This commit is contained in:
		@@ -2,11 +2,11 @@ waybar-keyboard-state(5)
 | 
			
		||||
 | 
			
		||||
# NAME
 | 
			
		||||
 | 
			
		||||
waybar - keyboard_state module
 | 
			
		||||
waybar - keyboard-state module
 | 
			
		||||
 | 
			
		||||
# 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
 | 
			
		||||
 | 
			
		||||
@@ -61,7 +61,7 @@ The following *format-icons* can be set.
 | 
			
		||||
# EXAMPLE:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
"keyboard_state": {
 | 
			
		||||
"keyboard-state": {
 | 
			
		||||
    "numlock": true,
 | 
			
		||||
    "capslock": true,
 | 
			
		||||
    "format": "{name} {icon}",
 | 
			
		||||
@@ -74,7 +74,7 @@ The following *format-icons* can be set.
 | 
			
		||||
 | 
			
		||||
# STYLE
 | 
			
		||||
 | 
			
		||||
- *#keyboard_state*
 | 
			
		||||
- *#keyboard_state label*
 | 
			
		||||
- *#keyboard_state label.locked*
 | 
			
		||||
- *#keyboard-state*
 | 
			
		||||
- *#keyboard-state label*
 | 
			
		||||
- *#keyboard-state label.locked*
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
    // Choose the order of the modules
 | 
			
		||||
    "modules-left": ["sway/workspaces", "sway/mode", "custom/media"],
 | 
			
		||||
    "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
 | 
			
		||||
    // "sway/workspaces": {
 | 
			
		||||
    //     "disable-scroll": true,
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
    //         "default": ""
 | 
			
		||||
    //     }
 | 
			
		||||
    // },
 | 
			
		||||
    "keyboard_state": {
 | 
			
		||||
    "keyboard-state": {
 | 
			
		||||
        "numlock": true,
 | 
			
		||||
        "capslock": true,
 | 
			
		||||
        "format": "{name} {icon}",
 | 
			
		||||
 
 | 
			
		||||
@@ -229,7 +229,7 @@ label:focus {
 | 
			
		||||
    min-width: 16px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#keyboard_state {
 | 
			
		||||
#keyboard-state {
 | 
			
		||||
    background: #97e1ad;
 | 
			
		||||
    color: #000000;
 | 
			
		||||
    padding: 0 0px;
 | 
			
		||||
@@ -237,10 +237,10 @@ label:focus {
 | 
			
		||||
    min-width: 16px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#keyboard_state > label {
 | 
			
		||||
#keyboard-state > label {
 | 
			
		||||
    padding: 0 5px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#keyboard_state > label.locked {
 | 
			
		||||
#keyboard-state > label.locked {
 | 
			
		||||
    background: rgba(0, 0, 0, 0.2);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -71,7 +71,7 @@ waybar::AModule* waybar::Factory::makeModule(const std::string& name) const {
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef HAVE_LIBEVDEV
 | 
			
		||||
    if (ref == "keyboard_state") {
 | 
			
		||||
    if (ref == "keyboard-state") {
 | 
			
		||||
      return new waybar::modules::KeyboardState(id, bar_, config_[name]);
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ extern "C" {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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),
 | 
			
		||||
      numlock_label_(""),
 | 
			
		||||
      capslock_label_(""),
 | 
			
		||||
@@ -31,7 +31,7 @@ waybar::modules::KeyboardState::KeyboardState(const std::string& id, const Bar&
 | 
			
		||||
                     : "unlocked"),
 | 
			
		||||
      fd_(0),
 | 
			
		||||
      dev_(nullptr) {
 | 
			
		||||
  box_.set_name("keyboard_state");
 | 
			
		||||
  box_.set_name("keyboard-state");
 | 
			
		||||
  if (config_["numlock"].asBool()) {
 | 
			
		||||
    box_.pack_end(numlock_label_, false, false, 0);
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user