The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

i3bar/i3status: Is it possible to have Caps-Lock and Num-Lock indicator ?

asked Feb 25 '13

syl20bnr gravatar image

updated Mar 7 '13

Question is in the title :)

Cheers,

Sylvain

EDIT: an i3status wrapper can be found here: github.com/syl20bnr/i3status-keyboard-leds

3 answers

Sort by » oldest newest most voted
0

answered Mar 5 '13

MeanEYE gravatar image

updated Mar 5 '13

It's not an easy way to achieve this, but it's not impossible either. You can use xset command. If you issue the following command:

$ xset q
Keyboard Control:
  auto repeat:  on    key click percent:  0    LED mask:  00000000
  XKB indicators:
    00: Caps Lock:   off    01: Num Lock:    off    02: Scroll Lock: off
  ...

As you can see you have LED mask which is bitmask of active flags, or you can parse strings from 00: Caps Lock: off.

So, what you need to do is make a wrapper script. You can see how this is done here.

After you have a wrapper script then configure your i3 status command to point to your script directly and that's about it. You combine output of i3status with strings you parse.

Comments

2

Thank you for your great support. The result script is here: https://github.com/syl20bnr/i3status-keyboard-leds

syl20bnr gravatar imagesyl20bnr (Mar 7 '13)edit

Awesome. :D

MeanEYE gravatar imageMeanEYE (Apr 8 '13)edit
1

answered Apr 26 '13

demil133 gravatar image

I've got this on my ~/.i3/config:

# Enable/disable caps mode
mode "caps" {
        bindsym Caps_Lock mode "default"
}
bindsym Caps_Lock mode "caps"

# Enable/disable numeric keyboard 
mode "num" {
        bindsym Num_Lock mode "default"
}
bindsym Num_Lock mode "num"

This will show an indicator like the "resize" one if you press $mod+r

for me this disables some keybindings I've got on my numeric keyboard so that I can use it for it's original purpose

Comments

Nice trick! Although it seems to be buggy if num lock and caps lock are both activated.

syl20bnr gravatar imagesyl20bnr (Jul 30 '13)edit

Been wanting this for ages, thanks.

massysett gravatar imagemassysett (Feb 4 '14)edit
1

answered Feb 27 '13

Michael gravatar image

No, there is no such feature built in. My computer has LEDs for that. Also, in my keyboard layout, I don’t have caps lock. If you want such an indicator, you have to wrap i3status with a custom script, see its manpage.

Comments

And what about pressing both shift keys? Should be the same.

frakturfreak gravatar imagefrakturfreak (Apr 26 '13)edit

Question Tools

Stats

Asked: Feb 25 '13

Seen: 2,337 times

Last updated: Apr 26 '13