How can I toggle the Fn key lock on an LG Gram running Linux?

Most laptops allow toggling the Fn key lock (whether you have to press the Fn key or not to use the special functions of the f1-f12 keys like adjusting screen brightness or volume), with a shortcut like Fn+esc, or a setting in the BIOS or system preferences. On the LG Gram, there is a setting in the BIOS (press F2 while on startup to boot to the BIOS, then press Ctrl+Alt+F7 to show more options, and look for the setting under Advanced), but that setting doesn't seem to have any effect when booted into Linux. I always have to press Fn to use the special functions of f1-f12.


I found the setting for the Fn key lock on the LG Gram in Linux. The setting is stored as a 1 or a 0 in a file called /sys/devices/platform/lg-laptop/fn_lock. To see what value is set, run cat /sys/devices/platform/lg-laptop/fn_lock. If it is 0 you need to press the Fn key to use the special functions, and if it is 1 you don't need to use the Fn key for the special functions. You can edit this file in a text editor, and change the value to 1 to lock the Fn key. But setting the value this way will only persist for the current session, and get reset on reboot.

To make this setting persistent after a reboot, you can create a udev rule. Create the file /etc/udev/rules.d/99-fnlock.rules with the following content:

SUBSYSTEM=="platform", DRIVER=="lg-laptop", ATTR{fn_lock}="1"

Now the function lock setting will be persistent after rebooting. You may find a few other interesting LG Gram feature settings here: https://www.kernel.org/doc/html/latest/admin-guide/laptops/lg-laptop.html