Informática geek, matemáticas, pensamiento crítico y alguna otra cosa de vez en cuando.

2013-04-24

Caps Lock Led Toggled problem

The cause: https://bugs.freedesktop.org/show_bug.cgi?id=16145

The solution: xdotool key Caps_Lock

Another alternative solution is to use xmacro: printf 'KeyStrPress Caps_Lock\nKeyStrRelease Caps_Lock\n' | xmacroplay $DISPLAY

Basically, the reason is that when faking a Caps Lock key press programmatically in order for an application to toggle the Caps Lock state, the led does not toggle and the state becomes out of sync between the led and the keyboard.

It used to happen when entering a word like tHIS in OpenOffice with Caps Lock on, though late versions seem to have fixed it. But I've also suffered it when using x11vnc and pressing Caps Lock in the client. At that moment, the keyboard becomes desynced. The command above syncs it again. The source code in the bug report linked above works well too, in case you can't find xdotool or xmacro. They come as Debian and Ubuntu packages, though, so they should be easy to find.

No comments: