Disable XF86Back and XF86Forward (browser back/forward on Lenovo Thinkpad)
My Thinkpad R500 has back/forward keys just about the direction keys, so on Firefox I keep losing entered text, accidentally.
How to disable these back/forward keys?
Excerpt from xev:
KeyPress event, serial 29, synthetic NO, window 0x5e00001,
root 0xbc, subw 0x0, time 2375874, (1279,794), root:(1285,881),
state 0x10, keycode 166 (keysym 0x1008ff26, XF86Back), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 32, synthetic NO, window 0x5e00001,
root 0xbc, subw 0x0, time 2377115, (1279,794), root:(1285,881),
state 0x10, keycode 167 (keysym 0x1008ff27, XF86Forward), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
Solution 1:
You can disable keys using the xmodmap
command. For example, to disable XF86Back
, run the following command:
xmodmap -e "keycode 166="
This sets the keycode 166
(Which is the keycode for XF86Back
as you can see in the xev
output) to nothing, which means it is disabled.
To re-enable XF86Back
:
xmodmap -e "keycode 166=XF86Back"
To disable both the Back and Forward keys automatically, create the file .xmodmap
in your home folder and paste the following inside it:
keycode 166=
keycode 167=