84

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 '17 at 5:40
  • 1
    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) May 13 at 10:42
222

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

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

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

10
  • Works for a MBP 6,1 (2010 17") Dec 27 '19 at 8:32
  • Worked on HP laptop with Ubuntu 18.04 using an Apple keyboard.
    – n1k31t4
    Apr 25 '20 at 18:35
  • Worked on Ubuntu 18 Ubuntu desktop w/ Apple keyboard Jun 3 '20 at 23:28
  • 2
    Worked for Ubuntu/PopOS 20.04 and doesn't even require reboot Jun 24 '20 at 3:10
  • Work with feker machinist 01, Ubuntu 18.04, no reboot :) Sep 22 '20 at 3:44
18

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.

1
  • 1
    Great tip because you can use one hand. Aug 29 '16 at 22:54
13

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.
    – CodeKid
    Jul 7 '19 at 13:03
11

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

2
  • 6
    is "Fn Lock" supposed to be a separate key? If so, where could it be found?
    – foo
    Jun 25 '20 at 11:55
  • 2
    @foo its your Escape(Esc) key, in the top left corner. Nov 6 '20 at 2:09
3

Press Fn+Num Lock to disable it.

1
  • Confirmed for Kloner Bluetooth Keyboard KTB0025.
    – emi
    Feb 15 '20 at 14:51
3

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

0
1

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 at 4:31
0

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!

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.