Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to change layout (mapping) of Lenovo ThinkPad keyboard (which I hate) to be like Acer TravelMate 8000 (which I love).

That mainly means:

  • Swap Fn and left Ctrl
  • Tab-left to act like PgUp
  • Fn' + Tab-left to act like Home
  • Tab-right to act like PgDown
  • Fn' + Tab-right to act like End
  • PgUp to act like Delete
  • Home to act like Insert

I've tried xev to see the codes.
I have found this list of symbols:
This is my result:

xmodmap -e 'keycode 112 = XF86Back'     # Remap PgUp to TabPrev
xmodmap -e 'keycode 117 = XF86Forward'  # Remap PgDn to Tabnext
xmodmap -e 'keycode 166 = Prior Home XF86Back'        # Remap TabPrev to PgUp.
xmodmap -e 'keycode 167 = Next End XF86Forward'       # Remap TabNext to PgDn.
xmodmap -e 'keycode 151 = Control_L'    # Remap FN to be Ctrl.
xmodmap -e 'keycode  37 = XF86WakeUp'   # Remap Ctrl to be FN.
xmodmap -e 'keycode  94 = Shift_L'      # Remap stupid left |\*& to be Shift too.

However it's not exactly what I need as it maps Shift + Tab* to Home, which prevents me using the Shift + Home' combo (to select text) and only works in some applications (e.g. doesn't work in Firefox to go to the top).

So - how should I map it?

Update: I used setkeycodes and found these scancodes:

                 Press            Release
TabLeft  - 158   ^[[5~0xe0 0x6a   0xe0 0xea 
TabRight - 159   ^[[6~0xe0 0x69   0xe0 0xe9
PgUp:            0xe0 0x49        0xe0 0xc9 
PgDn:            0xe0 0x51        0xe0 0xd1 

Ctrl:            0x1d             0x9d 
FN:              0xe0 0x63        0xe0 0xe3

Update: I also found that dumpkeys shows interesting info. Like, string aliases for some keys; e.g., the ^[[5~ shown by showkey -s is defined there.

Update: I've tried setkeycodes:

sudo setkeycodes 0xE063  29  ##  Fn   to Ctrl
sudo setkeycodes 0x1d   143  ##  Ctrl to Fn
sudo setkeycodes 0x56    42  ##  |\*& to Shift

showkeys -k shows the right keycodes coming, but still they don't work so - e.g. Ctrl+T doesn't open a tab in FF etc.
After reverting the changes, everything works as before.

sudo setkeycodes 0xE063 143  ##  Fn   to Ctrl
sudo setkeycodes 0x1d    29  ##  Ctrl to Fn

What do I miss?

share|improve this question

Came across this post looking for the status of the issue that key codes > 128 could not be mapped as modifier key. Last time I checked this was my reason for not being able to swap fn/ctrl.

share|improve this answer

Your Answer


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.