How can I toggle the Fn (function) key?

117,043

Solution 1

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.

Solution 2

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

Solution 3

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

Solution 4

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

Solution 5

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.

Share:
117,043

Related videos on Youtube

oscar
Author by

oscar

Updated on September 18, 2022

Comments

  • oscar
    oscar over 1 year

    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.

    • roeland
      roeland over 6 years
      This could be an option in your bios.
    • Frank Nocke
      Frank Nocke about 3 years
      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)
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 7 years
    Great tip because you can use one hand.
  • Jithin Pavithran
    Jithin Pavithran over 6 years
    Works with some laptops like Lenovo Thinkpad series.
  • Jujhar Singh
    Jujhar Singh about 6 years
    Works great on my Lenovo T460 and Dell XPS 15
  • TheCommoner282
    TheCommoner282 over 5 years
    Works with Dell Inspirion 5000 series. Thank you Andrey
  • MathKid
    MathKid almost 5 years
    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.
  • Craig Wilcox
    Craig Wilcox almost 5 years
    Fn + Esc Works like a charm on my DELL Inspiron 15 ~ Thanks! Not sure what 'media functions' is/means
  • ftassi
    ftassi over 4 years
    it seems not to be working on macbook pro 11,4
  • Eric Dela Cruz
    Eric Dela Cruz over 4 years
    Works for a MBP 6,1 (2010 17")
  • emi
    emi over 4 years
    Confirmed for Kloner Bluetooth Keyboard KTB0025.
  • Liam Baker
    Liam Baker about 4 years
    This doesn't work on all laptop brands...
  • Igor Rodriguez
    Igor Rodriguez about 4 years
    In the HP Zbook G5 the shortcut is Fn + Shift support.hp.com/us-en/document/c02035108
  • n1k31t4
    n1k31t4 about 4 years
    Worked on HP laptop with Ubuntu 18.04 using an Apple keyboard.
  • Manikandaraj Srinivasan
    Manikandaraj Srinivasan about 4 years
    This works on my Dell Latitude. And this should have been the accepted answer IMHO.
  • Ezekiel Victor
    Ezekiel Victor almost 4 years
    Worked on Ubuntu 18 Ubuntu desktop w/ Apple keyboard
  • Willi Mentzel
    Willi Mentzel almost 4 years
    doesn't work on Dell XPS 9570 and Ubuntu 20.04 LTS :(
  • Vignesh
    Vignesh almost 4 years
    This worked on Dell Vostro series laptop, I was confused what the hell happened doing this reversed the keys back to normal
  • Anton Matosov
    Anton Matosov almost 4 years
    Worked for Ubuntu/PopOS 20.04 and doesn't even require reboot
  • foo
    foo almost 4 years
    is "Fn Lock" supposed to be a separate key? If so, where could it be found?
  • aderchox
    aderchox over 3 years
    Doesn't work on my HP laptop Ubuntu 20.04
  • Tiana987642
    Tiana987642 over 3 years
    Work with feker machinist 01, Ubuntu 18.04, no reboot :)
  • Akshay Alva
    Akshay Alva over 3 years
    @foo its your Escape(Esc) key, in the top left corner.
  • A. Steenbergen
    A. Steenbergen over 3 years
    How can I make this work across reboots?
  • kumetix
    kumetix over 3 years
    Lovely! works on Dell XPS 15, Ubuntu 18.04.5
  • Zanna
    Zanna over 3 years
    @A.Steenbergen you can probably use sysfsutils - see my answer here for an example (for a different setting - adjust as needed).
  • Edgar Ramírez Mondragón
    Edgar Ramírez Mondragón about 3 years
    Worked on my Dell G7 with Ubuntu 20.04
  • Borislav Gizdov
    Borislav Gizdov about 3 years
    Great, worked on ubuntu 20.04 with Keychron K3 keyboard (Mac mode)
  • mwieczorek
    mwieczorek about 3 years
    Tip of the day! I recently bought a new MSI Prestige that swaps the F keys with volume, keyboard backlight, etc. I'm a developer, so I always need the original F key functionality. I wish I could upvote this answer twice.
  • veritas1
    veritas1 almost 3 years
    Thanks! Got a new Vamillo (VA88M) keyboard, using with PopOS, and the fact that media controls were the default action was bugging me.
  • 王子1986
    王子1986 over 2 years
    works for manjaro system as well
  • Kakiz
    Kakiz over 2 years
    That was very helpful, i switched from media key to function key at BIOS
  • MRule
    MRule over 2 years
    Doesn't seem to work on LenovoP50
  • MRule
    MRule over 2 years
    In that case, this is the same as /u/Andrew's answer --- and it doesn't work on all systems.
  • Kalizi
    Kalizi over 2 years
    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!
  • KaKi87
    KaKi87 about 2 years
    Worked on Ubuntu 21.10 using a Matias keyboard, thanks.
  • Arpad Horvath
    Arpad Horvath about 2 years
    I've just realized that there is a small FnLk written on my Thinkpad X250s Escape button. Easier to find out next time.
  • Admin
    Admin about 2 years
    Worked like a charm on latest Gnome! First time I see gnome changing my Fn .. unsure why but thanks
  • Admin
    Admin about 2 years
    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.
  • Admin
    Admin almost 2 years
    Brightness up and down?
  • Admin
    Admin almost 2 years
    On HP laptops the fn lock key is the left shift key.