Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
share|improve this question
add comment

1 Answer 1

up vote 14 down vote accepted

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=
share|improve this answer
    
Works great :-) –  Nicolas Raoul Feb 2 '11 at 7:54
5  
I could also suggest you to sue them as Home and End keys. This works great for text editing on my ThinkPad. Simply set the keycode equal to Home and End. –  Rasmus Mar 7 '12 at 9:08
    
This works on my ThinkPad X220 too. Thanks! –  Joe May 8 '12 at 18:08
1  
xmodmap -e "keycode 166=" works perfectly, but when I add the file .xmodmap with the contents to my home the back and forward still working. am I missing something here? –  Husni Aug 23 '13 at 12:29
1  
@Husni: same here. Looks like the name varies. On some systems it's .xmodmaprc, on Ubuntu it appears to be .Xmodmap since oneiric. –  Mu Mind Nov 2 '13 at 23:40
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.