134

Is there a way to toggle the Fn key? I'd like to be able to toggle it so I don't have to press Fn+F12 to raise the volume, for example.

I'm running Ubuntu 16.04.1 LTS on an Asus D550C.

2
  • 5
    This could be an option in your bios.
    – roeland
    Nov 12, 2017 at 5:40
  • 2
    Should be in your BIOS → config → is usually either „F1-F12 as Primary Function: On“ or something like „HotKey Mode“ (change from enabled to disabled or vice versa)
    – Frank N
    May 13, 2021 at 10:42

14 Answers 14

301

For some computer models, to toggle F1 .. F12 keys use media functions or to be the "F" keys press Fn + Esc .

21
  • 13
    Works with some laptops like Lenovo Thinkpad series. Sep 10, 2017 at 11:03
  • 3
    Works great on my Lenovo T460 and Dell XPS 15 Feb 21, 2018 at 22:34
  • 2
    Works with Dell Inspirion 5000 series. Thank you Andrey Dec 26, 2018 at 15:06
  • 18
    This doesn't work on all laptop brands...
    – Liam Baker
    Feb 24, 2020 at 8:11
  • 3
    doesn't work on Dell XPS 9570 and Ubuntu 20.04 LTS :( Jun 7, 2020 at 19:50
81

If you have an Apple keyboard and want the function keys to act like F1-F12 by default (disable Fn default behavior) give the following command in terminal:

echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode

from here: https://help.ubuntu.com/community/AppleKeyboard#Change_Function_Key_behavior

14
  • Works for a MBP 6,1 (2010 17") Dec 27, 2019 at 8:32
  • Worked on HP laptop with Ubuntu 18.04 using an Apple keyboard.
    – n1k31t4
    Apr 25, 2020 at 18:35
  • 3
    Worked for Ubuntu/PopOS 20.04 and doesn't even require reboot Jun 24, 2020 at 3:10
  • 2
    How can I make this work across reboots? Nov 6, 2020 at 9:58
  • 1
    @A.Steenbergen you can probably use sysfsutils - see my answer here for an example (for a different setting - adjust as needed).
    – Zanna
    Nov 14, 2020 at 14:27
26

As far as I know, the Fn key does not get detected by the OS but modifies your other keys on a firmware level. That means you can neither retrieve nor control the state of the Fn key from Ubuntu.


What you could do instead is to change the keyboard shortcut for increasing/decreasing audio volume to an alternative key combination instead of the Fn-modified special key.

Open System Settings → Keyboard and go to the Shortcuts tab. In the list on the left side, select Sound and Media.

After clicking on an entry in the list on the right side (in your case you want to edit Volume up and Volume down), you can press a combination of keys you want to assign to this shortcut. Esc cancels the editing and ← Backspace disables the shortcut.

3
  • 2
    Great tip because you can use one hand. Aug 29, 2016 at 22:54
  • 1
    Brightness up and down? May 24, 2022 at 16:06
  • It was necessary to select function key behavior in bios for me.
    – rela589n
    Dec 14, 2022 at 14:58
23

Press Fn+Fn Lock. It will toggle between Enable and Disable.

6
  • 6
    is "Fn Lock" supposed to be a separate key? If so, where could it be found?
    – foo
    Jun 25, 2020 at 11:55
  • 2
    @foo its your Escape(Esc) key, in the top left corner. Nov 6, 2020 at 2:09
  • 2
    In that case, this is the same as /u/Andrew's answer --- and it doesn't work on all systems.
    – MRule
    Jan 18, 2022 at 14:29
  • 1
    I've just realized that there is a small FnLk written on my Thinkpad X250s Escape button. Easier to find out next time. Apr 20, 2022 at 11:05
  • 1
    On HP laptops the fn lock key is the left shift key.
    – Marijn
    Jun 2, 2022 at 8:28
16

My laptop has a Fn Lock key which is useful, except when it's been pressed by accident. Then pressing F5 in Firefox doesn't reload the page; it switches off the touch pad. I now know what it is but it had me totally bamboozled having to reboot or logout to get the touch pad back working.

1
  • 1
    With the Microsoft Natural Ergonomic Keyboard 4000 this key is called F lock and is located on the top row next to F12. Pressing it toggles a green LED at the bottom of the keyboard with an F below it. If the LED is off, the function keys don't work.
    – MathKid
    Jul 7, 2019 at 13:03
6

On HP probook 450, left shift has fn lock, so fn+leftShift locks it.

0
5

Press Fn+Num Lock to disable it.

1
  • Confirmed for Kloner Bluetooth Keyboard KTB0025.
    – emi
    Feb 15, 2020 at 14:51
2

Look in the BIOS. For Acer laptop I can choose the toggle on Fn touch in it.

1
  • That was very helpful, i switched from media key to function key at BIOS Sep 22, 2021 at 4:31
1

In addition to zardosht answer above as I cannot comment yet.

echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode

To make this work after reboots I followed Zanna's link to add in sysfutils Ubuntu 17.04 Macbook Pro Tilde key Fix

Added this in the last line to end of file

module/hid_apple/parameters/fnmode = 2

save, reboot and should be working.

Thanks!

2
  • Thank you, this saved my day! If someone gets here, this will switch the function keys to the default behaviour, keeping multimedia working with FN key!
    – Kalizi
    Jan 30, 2022 at 9:21
  • This helped me as well: I have a mechanical keyboard from a chinese manufacturer - Hello Gonass which has an fn key. Works fine on windows but the fn keys don't work on Linux. echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode makes it work again.
    – Alterlife
    May 6, 2022 at 10:37
1

Ubuntu 20.04
From BIOS (if fn + Esc is not work)

  • Go to the Bios
  • Navigate to the Main tab
  • Look for the Function Key Behaviour setting and set Function Key instead of the Media Key option.
0

On some Keyboard, the left shift is the fn lock key. Press fn+left shift to toggle

0

On microsoft keyboard with trackpad:

[Fn-Caps]

0

On Huawei laptops, press fn key once. This will toggle the behaviour. On some models, the "disabled" behaviour will be indicated with a LED light on.

0

I have a ThinkPad T480 with a Keychrone K3 and what worked for me was:

echo 1 | sudo tee /sys/module/hid_apple/parameters/fnmode

The default was 3, the 2 option doesn't work, but the 1 is working well.

You must log in to answer this question.

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