I'm trying to toggle caps lock on/off when the two shift buttons are held down for a second. I've tried using the virtkey module, but it's not working. That module does work for other keys though, so I don't think I'm using the module incorrectly.
Does anybody have a way for doing this?
Just to be clear, I want to actually toggle caps lock on/off and not just the LED.
Thanks!
This works for me (turns the led on and off as well as enable/disable caps)
Here are some more examples
You can also get a toggle like behaviour just using release_keycode
Funny thing. I gave virtkey a try in the interpreter, and it seemed like it was working. After calling
press_keycode(50)
, my machine acts like caps lock has been pressed (Ubuntu 9.10, python-virtkey .50ubuntu2). If I release the key-release_keycode(50)
- it acts like nothing has happened.if run as a script, leaves the caps key pressed for a virtual terminal tab. Very annoying.
Have you looked into the xvkbd command? It's an X virtual keyboard with command line options, and worst case you could call it from python. Another idea to look into is xmodmap, which lets you re-map keys in X. See this post on SU for an example.