- run
xev
which opens a new window - when you type the key that you want to rebind, the terminal from which
xev
is run will display all the info about that key - look for the keycode section
- gather all the keycodes this way
-
run
xmodmap -e "keycode <number> = <expression>"
where expression is the value (Escape, Control_L, etc.) -
the changes made here are temporary, the example below shows how to make them permanent
-
each keysym column in the table corresponds to a particular combination of modifier keys:
keycode N = <Key> <Shift + Key> <mode_switch + Key> <mode_switch + Shift + Key> <AltGr + Key> <AltGr + Shift + Key> example: keycode 49 = grave asciitilde grave asciitilde
-
to assign a blank keysym use
NoSymbol
as a value -
to print the current keycode > keysym table run
xmodmap -pke
- reset the changes to the default layout:
setxkbmap -layout us
- rebinding CapsLock to Esc
xmodmap -e "clear lock"
xmodmap -e "keycode 66 = Escape"
xmodmap -pke > ~/.xmodmap.conf
xmodmap ~/.xmodmap.conf
- add the last line as a startup command to make the changes permanent
~/.zshrc
if [ -s ~/.xmodmap.conf ]; then
xmodmap ~/.xmodmap.conf
fi