118

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

12 Answers 12

272

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

17
75

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
  • Worked on Ubuntu 18 Ubuntu desktop w/ Apple keyboard Jun 3, 2020 at 23:28
  • 3
    Worked for Ubuntu/PopOS 20.04 and doesn't even require reboot Jun 24, 2020 at 3:10
  • 1
    How can I make this work across reboots? Nov 6, 2020 at 9:58
23

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
19

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
  • 1
    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
14

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
5

Press Fn+Num Lock to disable it.

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

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

0
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
    – Kakiz
    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
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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.