For some reason my laptop is stuck in Caps Lock. I have the Caps Lock key mapped by xmodmap to hyper_l, so I don't have a caps_lock key to turn it off. Is there a way I can turn it off by command line? It would be nice if I could reset the lock state without resetting my computer, especially for future reference. This has happened before, but I would like to know now how to do it properly this time.
|
|
|||||||
|
|
I don't know of any command line tool for that in Ubuntu. (For Num Lock, there is numlockx
Here it is again in a more expanded form. We use the Python ctypes library to call C functions from the X library directly. The function
If you have a stuck modifier, change 2 to the mask of the modifiers you want to turn off. The modifiers are 1=Shift, 2=Lock (Caps Lock), 4=Control, 8=Mod1, 16=Mod2, 32=Mod3, 64=Mod4, 128=Mod5. Run Also possibly of interest is a way to temporarily ignore Caps Lock:
After this, Caps Lock will effectively be permanently off, until you reenable it with |
||||