(okay, stackexchange is messing with my step numbers. They obviously should not read 1, 1, 1, 2, 3, but 1, 2, 3, 4, 5. Don't ask me why this is happening. The answer should still be helpful, though)
- Use the xev command. When you hit enter, xev will launch. xev takes all of your input and poops info about the key into the command line. I recommend bringing your mouse over the exit key of the xev window, hitting caps lock (or whatever key you want to find out about), and immediately exiting xev. The relevant lines on my system, for caps lock look something like:
KeyPress event, serial 36, synthetic NO, window 0x4400001,
root 0x27a, subw 0x0, time 19164277, (16,-9), root:(1156,46),
state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x4400001,
root 0x27a, subw 0x0, time 19164397, (16,-9), root:(1156,46),
state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
Notice "keycode" (66) and "keysym" (0xffe5).
You could also, now, get data for another key -- one you don't really use, and which, in the context you want to use the caps lock button in, doesn't do anything. So, if you want caps lock to activate the Unity searchbox (like super usually does), maybe use `, for example. On my machine:
keycode 49 (keysym 0x60, grave)
- Bind the new key's function to the Caps Lock button, using xmodmap. I'm pretty sure you want to use a command like:
xmodmap -e "keycode 66=0x60"
Now, if you hit the physical caps lock button in a text box, the grave character (`) will appear. But if you map a shortcut key to it, it will do something else. If you want to be able to use it in a text box, perhaps replace caps lock with left shift, or f10, or something else that doesn't seem like it will interfere with the command you want to use.
Test it to make sure the command I gave you works the way you want it to.
Go to startup applications, and add that command to your startup applications. This way, the key will switch properly every time you start up.
Dance.
(shout out to theprise) Change Keybindings (hardware to software)
Also, for more help on xmodmap:
http://www.xfree86.org/4.2.0/xmodmap.1.html
http://www.in-ulm.de/~mascheck/X11/xmodmap.html
xmodmap -e "remove lock = Caps_Lock"As I know ! correct me if I am wrong! – Binarylife Jul 14 '11 at 4:21