I have a lenovo thinkpad where FN+arrow keys is mapped to multimedia keys. For consistency with my other laptops I would like these instead to map to home, end, page-up and page-down.

I am running Debian stretch with the mate desktop, how can I do this?

1 Answer 1


The first step is to go into system -> preferences -> keyboard shortcuts and disable the keyboard shortcuts for play, stop, previous track and next track. This was a necessary first step, before it was done the keycodes would not show up in xev.

Once that was done I was able to follow the instructions in I found the keycodes were

  • FN+Left (aka previous): 173
  • FN+Right (aka next): 171
  • FN+UP (aka stop): 174
  • FN+Down (aka play): 172

xev can again be used to determine the "keysyms" for home, end, page up and page down.

  • Home: Home
  • End: End
  • Page up: Prior
  • Page down: Next

One can remap the keys for the current session with

xmodmap -e "keycode 173 = Home"
xmodmap -e "keycode 171 = End"
xmodmap -e "keycode 174 = Prior"
xmodmap -e "keycode 172 = Next"

There doesn't seem to be any good way to make this permanent, apparently .Xmodmap doesn't work on many modern systems and all the other options seem to involve either manually running scripts or editing files in /usr, I decided editing files in /usr was the least bad option.

Specifically I edited /usr/share/X11/xkb/symbols/inet, replacing the settings for keys I171 through I174 with

    key <I171>   {      [ End                   ]       };
    key <I172>   {      [ Next                  ]       };
    key <I173>   {      [ Home                  ]       };
    key <I174>   {      [ Prior                 ]       };

Thanks to the following sources for nuggets of information needed to solve this problem

Use setxkbmap to swap the Left Shift and Left Control

  • Just be prepared to lose your changes on any upgrade of the xkb-data package. Jun 8, 2019 at 5:20
  • Yeah, I wish I could find a better solution, but all the solutions seem problematic in one way or another.
    – plugwash
    Jun 8, 2019 at 7:52
  • I guess I could use a diversion to protect the file from upgrades.
    – plugwash
    Jun 8, 2019 at 7:56
  • Or put it in hold and reapply your patch after the manual upgrades. However, I'd just run those xmodmap commands from my X startup file (.xsession). For a system-wide effect /etc/X11/Xsession.d is also an option. Jun 9, 2019 at 7:30

You must log in to answer this question.

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