Hi.
Really great work done. I have setup Powerline in i3wm.

Since my laptop don't have a led to show the lock keyboard status, I miss a segment to show the locks keyboard status in the bar (caps lock, num lock).
Something similar to this in py3status
I can't help with code, since I'm not a developer, just a simple user!
Greetings.
Done: kbd.py


However, some caveats:
xset -q, meaning that this segments only works whenever that works. Especially it will not work whenever you're outside of X; it should be possible to fix this to some extend.vim or a shell; I don't see how to fix this. (Using a ThreadedSegment instead will not help: Even if the segment updates, changes are not rendered)Thanks a lot for your code!!
Can't find where the segments are! Where do I have to create the kbd.py file?
The segments are at powerline_root/powerline/segments/, where powerline_root is usually something like /usr/lib/python3.7/site-packages/. Note that directly adding files to this directory is a hot fix at best and may break with powerline updates, so use this at your own risk.
A slightly better solution would be to create a (dummy) package for the file by creating a new subdirectory of /usr/lib/python3.7/site-packages/ and adding kbd.py and an empty file named __init__.py:
/usr/lib/python3.7/site-packages/<your_package_name>
├── kbd.py
└── __init__.py
Note that in your config files, you then also need to point to <your_package_name>:
"function": "<your_package_name>.kbd.lock_status".
(Note that the paths above assume you use python 3.7; if you use a different version, the paths change accordingly.)
mmm didn't work :(
I create a file called kbd.py in /usr/lib/python3.7/site-packages/powerline/segments/common
And in my config added:
{
"function": "powerline.segments.common.kbd.lock_status"
},
But nothing happen... (yep running python 3.7) Maybe I made something wrong?
What you did looks correct... Please try the following:
xset -q work in a terminal? (If not, you may need to install a package like xorg-xset or similar)$PYTHON_SITE_PATH/powerline/bindings/lemonbar/powerline-lemonbar.py and check whether it reports any errors. (Alternatively, configure powerline to use a log file and check that log file for any errors; consult the docs for the details, especially the log_file paragraph.)xset -q seems to work properly. When I run the command I get:
Keyboard Control:
auto repeat: on key click percent: 0 LED mask: 00000002
XKB indicators:
00: Caps Lock: off 01: Num Lock: on 02: Scroll Lock: off
03: Compose: off 04: Kana: off 05: Sleep: off
06: Suspend: off 07: Mute: off 08: Misc: off
09: Mail: off 10: Charging: off 11: Shift Lock: off
12: Group 2: off 13: Mouse Keys: off
auto repeat delay: 660 repeat rate: 25
auto repeating keys: 00ffffffdffffbbf
fadfffefffedffff
9fffffffffffffff
fff7ffffffffffff
bell percent: 50 bell pitch: 400 bell duration: 100
Pointer Control:
acceleration: 2/1 threshold: 4
Screen Saver:
prefer blanking: yes allow exposures: yes
timeout: 600 cycle: 600
Colors:
default colormap: 0x22 BlackPixel: 0x0 WhitePixel: 0xffffff
Font Path:
/usr/share/fonts/misc:unscaled,/usr/share/fonts/Type1/,/usr/share/fonts/100dpi:unscaled,/usr/share/fonts/75dpi:unscaled,/usr/share/fonts/ghostscript/,/usr/share/fonts/cyrillic:unscaled,/usr/share/fonts/truetype/,built-ins
DPMS (Energy Star):
Standby: 600 Suspend: 600 Off: 600
DPMS is Enabled
Monitor is On
Font cache:
Server does not have the FontCache Extension
And maybe this can be useful to you:
2019-09-27 18:27:43,224:ERROR:wm:lock_status:Failed to set highlight group: 'Highlighting groups not found in colorscheme: keyboard:caps_lock_on, keyboard:caps_lock_off, keyboard'
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/powerline/segment.py", line 151, in set_segment_highlighting
segment.get('gradient_level')
File "/usr/lib/python3.7/site-packages/powerline/colorscheme.py", line 105, in get_highlighting
raise KeyError('Highlighting groups not found in colorscheme: ' + ', '.join(groups))
KeyError: 'Highlighting groups not found in colorscheme: keyboard:caps_lock_on, keyboard:caps_lock_off, keyboard'
Seems to be an issue with my colorscheme...
Ah of course, I forgot to mention that you need to define at least the highlight group keyboard in your color scheme; this seems to be the issue.
(Optionally, you may also define separate colors for the various different different lock states; e.g. keyboard:caps_lock_on, keyboard:caps_lock_off etc)
My colorscheme is in:
~/.config/powerline/colorschemes/shell/default.json
In that file I have added something like:
"keyboard": { "fg": "white", "bg": "darkestpurple", "attrs": [] },
but doesn't works... don't know if is that file the right one to add the highlight group...
(and thanks a lot for your support)
I got it!!! :)

Now I have to configure to show only caps and num locks...
THANKS a lot for your support, your code (and your patience) :)
Nice!
For the configuration, set the argument locks to {'Caps Lock': 'Caps', 'Num Lock': 'Num'}; only keys present in that dictionary will be shown. You can also replace the on/off with something more fancy with the status_dict argument.
Most helpful comment
I used nerd fonts
"Caps lock" is off, and "Num lock" is on