I am accustomed to pressing Fn+Left to simulate the Home key and Fn+Right for End.

On a keyboard with physical Home and End keys, using these Fn keyboard shortcuts do not work.

How can I map custom Fn keyboard shortcuts on Ubuntu Linux?

  • 1
    possible duplicate of Bind multimedia keys. It is not an exact duplicate in the problem description perhaps, but it is solved by the same underlying process. Commented Jun 1, 2012 at 6:40
  • Is anybody using modern (2018) laptops like HP Spectre x360 (although it has separate PgUp etc keys ) and Dell XPS aware if the Function key is detected like the other keys are?
    – MycrofD
    Commented Jan 16, 2018 at 14:26
  • 1
    I am using Lenovo Thinkpad X1 Carbon with Fn key, which is detected as keycode 151 by xev. While Fn is pressed Left and Right keys produce no events. Fn+F2 produces no events, but works as expected - lowers volume.
    – Suor
    Commented Mar 5, 2019 at 9:53

3 Answers 3


Unlike modifiers such as Alt and Ctrl, pressing the Fn key is never communicated to the operating system. The key merely modifies the scancodes of other keys, so pressing Fn+Right would emulate an End key, even though it may not physically exist, but they are indistinguishable by the OS. This behaviour is controlled exclusively by the keyboard electronics and can therefore not be altered without messing with the circuitry or microcontroller.

  • 2
    There is one operating system and computer that is definitely an exception to this rule and that is mac laptops. You can modify this key using Karabiner actually. Also thinkpads send this key to the operating system but it isn't a modifier key like on macs.
    – William
    Commented Aug 23, 2018 at 4:36
  • 2
    This is not true. xev shows Fn key presses.
    – Suor
    Commented Mar 5, 2019 at 9:40
  • 5
    Well, on my Dell machine with a Debian 10, xev doesn't show anything when Fn key is pressed.
    – Pierre
    Commented May 15, 2019 at 19:24
  • @Suor Which system was that? We all want one! Commented May 13, 2021 at 12:17
  • 1
    @joeytwiddle it's Ubuntu 20.10 on Thinkpad X1 Carbon
    – Suor
    Commented May 14, 2021 at 3:23

On most systems it is not possible to detect the Fn key itself, but you could try using:

$ xev | grep --line-buffered keysym

to find out what keys Fn-Left and Fn-Right do send. (The grep just reduces the noise.)

If you are lucky, those keypresses will send unimportant keystrokes to the machine, which you can then remap.

For example, on my system, xev shows that my Fn-Left keypress actually sends an XF86AudioPrev event:

state 0x0, keycode 173 (keysym 0x1008ff16, XF86AudioPrev), same_screen YES,

I can easily remap this to translate into a Home key event:

$ xmodmap -e 'keysym XF86AudioPrev = Home'

Hopefully you will be able to do the same for End, PageUp and PageDown.

Unfortunately if xev does not receive anything unique when you press Fn-Left then you are out of luck.

It's a real shame that Fn keypresses are not sent directly like the other modifier keys are. If they were, we would have much more power to configure their meaning through software.

  • Unfortunately fn on my laptop doesn't register with key up and key down events in the same way as other keys there by keeping this from working correctly for a modifier key. You can remap it to other one press keys though.
    – William
    Commented Aug 23, 2018 at 4:37

I opened xev in a terminal. It detects when I press the Shift, Ctrl, Alt, and Win (Super), but when I pressed the Fn key it doesn't detect it.

So the software has nothing to do with the Fn key; it's up to the hardware to decide what key gets sent to the software (e.g. the Home or End key).

So your keyboard must already have it to be able to do this.

You must log in to answer this question.

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