2

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

Acer TravelMate 8000 keyboard

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?

2 Answers 2

2

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.

0

Swapping Ctrl and fn keys in ThinkPad is possible in BIOS: https://support.lenovo.com/us/en/solutions/ht074187-how-to-swap-the-fn-function-and-ctrl-control-keyboard-keys-in-bios

For what I can tell this is the only working way as Ctrl has some sort of special meaning and is impossible to be swapped on OS level.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .