Friday, June 30, 2017

change key map in linux

1- install tools
$ sudo apt-get install x11-xserver-utils x11-utils

2- read key map
$ xev

when press j we get the following output
 
KeyRelease event, serial 36, synthetic NO, window 0x2c00001,
    root 0xe5, subw 0x0, time 6959590, (-485,434), root:(1020,453),
    state 0x10, keycode 44 (keysym 0x6a, j), same_screen YES,
    XLookupString gives 1 bytes: (6a) "j"
    XFilterEvent returns: False


3- to change the j key to backspace use the following command
$ xmodmap -e "keycode 44 = BackSpace"



- to set 0 to be  XF86Tools

$ xmodmap -e "keycode 19 mod2 = XF86Tools"

4- those changes will not survive the reboot, so to overcome it use the following command
$ xmodmap -pke >~/.Xmodmap


- we all can use the following argument to get different lists
    -pm                          print modifier map
    -pk                          print keymap table
    -pke                         print keymap table as expressions
    -pp                          print pointer map


$ xmodmap -pm

No comments:

Post a Comment