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: http://cs.gmu.edu/~sean/stuff/n800/keyboard/keysymdef.h
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?

link|improve this question

71% accept rate
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.