1. Start terminal window and run
xev
. Now it's active and waits for you to press a key. Then press the key whose behavior you want to change:$xev
KeyRelease event, serial 36, synthetic NO, window 0x5a00001,
root 0xb5, subw 0x0, time 4740799, (-257,-664), root:(468,237),
state 0x11, keycode 18 (keysym 0x28, parenleft), same_screen YES,
XKeysymToKeycode returns keycode: 187
XLookupString gives 1 bytes: (28) "("
XFilterEvent returns: False
KeyPress event, serial 36, synthetic NO, window 0x5a00001,
root 0xb5, subw 0x0, time 4741289, (-257,-664), root:(468,237),
state 0x11, keycode 19 (keysym 0x29, parenright), same_screen YES,
XKeysymToKeycode returns keycode: 188
XLookupString gives 1 bytes: (29) ")"
XmbLookupString gives 1 bytes: (29) ")"
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x5a00001,
root 0xb5, subw 0x0, time 4894370, (-353,-482), root:(372,419),
state 0x10, keycode 69 (keysym 0xffc0, F3), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 36, synthetic NO, window 0x5a00001,
root 0xb5, subw 0x0, time 4895370, (-353,-482), root:(372,419),
state 0x10, keycode 70 (keysym 0xffc1, F4), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
2. Now when you want to swap the two keys use
xmodmap
.
$ xmodmap -e "keycode 69 = parenleft"
$ xmodmap -e "keycode 70 = parenright"
+++++TESTING+++++
Soonafter remaping the keys,
key night and key zero have been disable! :S
It will be necessary to read more detailed information to get
an appropriate config.
Nonetheless, after rebooting the previous-mentioned commands are working and it does not need to remap the keys 9 and 0 again, i.e.
xmodmap -e "keycode 18 = 9"
xmodmap -e "keycode 19 = 0"
KeyRelease event, serial 36, synthetic NO, window 0x4a00001,
root 0xb5, subw 0x0, time 212931, (-415,-323), root:(548,578),
state 0x10, keycode 18 (keysym 0x39, 9), same_screen YES,
XLookupString gives 1 bytes: (39) "9"
XFilterEvent returns: False
KeyPress event, serial 36, synthetic NO, window 0x4a00001,
root 0xb5, subw 0x0, time 213451, (-415,-323), root:(548,578),
state 0x10, keycode 19 (keysym 0x30, 0), same_screen YES,
XLookupString gives 1 bytes: (30) "0"
XmbLookupString gives 1 bytes: (30) "0"
XFilterEvent returns: False
Nonetheless, after rebooting the previous-mentioned commands are working and it does not need to remap the keys 9 and 0 again, i.e.
xmodmap -e "keycode 18 = 9"
xmodmap -e "keycode 19 = 0"
root 0xb5, subw 0x0, time 212931, (-415,-323), root:(548,578),
state 0x10, keycode 18 (keysym 0x39, 9), same_screen YES,
XLookupString gives 1 bytes: (39) "9"
XFilterEvent returns: False
KeyPress event, serial 36, synthetic NO, window 0x4a00001,
root 0xb5, subw 0x0, time 213451, (-415,-323), root:(548,578),
state 0x10, keycode 19 (keysym 0x30, 0), same_screen YES,
XLookupString gives 1 bytes: (30) "0"
XmbLookupString gives 1 bytes: (30) "0"
XFilterEvent returns: False
+++++++++++
Note: These change are for the active x session only and will be lost after reboot.
When you want to save the changes permanently you have to run the following commands after the ones above:
Then you have to create a file called
xmodmap -pke >~/.Xmodmap
(it creates a files called .Xmodmap in your home directory ~ )Then you have to create a file called
.xinitrc
in your home directory where you put this commandline xmodmap .Xmodmap
in.
No comments:
Post a Comment