Monday, November 20, 2023

The Hidden Secrets of the Fn Key

Adam Engst:

Apple began adding a globe icon to the Fn keycap a few years ago and, starting in macOS 14 Sonoma, began to call it the Globe key. This is likely for consistency with iPad keyboards, which dropped the lowercase “fn” letters entirely in favor of a globe icon.

[…]

Because Apple doesn’t include the Fn key in the public Hot Key API, macro utilities like Keyboard Maestro can’t access it for the most part, as Peter Lewis explains. However, the Fn key can now be treated more like a modifier key with the free Karabiner-Elements or the $10 BetterTouchTool, both of which can access the keyboard at a lower level than the public APIs.

[…]

With Monterey, Apple also started letting us remap one modifier key (other than Shift) to another, so the Fn key could mimic Control for those who reach for the lower-left corner without looking.

[…]

In recent macOS releases, Apple has continued to hard-code additional capabilities into the Fn key.

I have yet to find a third-party keyboard where the Fn key works like on an Apple keyboard.

Previously:

Update (2023-12-11): See also: Hacker News.

5 Comments RSS · Twitter · Mastodon


Eduard Rozenberg

Same, on my Keychron keyboard the Fn key works only to switch the F1-F12 keys to their alternate mode, but does not perform any of the other shortcuts Apple defines using the Fn key.


It can probably be emulated on a QMK/VIA keyboard like some Keychrons or the NuPhy Air V2. That said, Apple handles it differently depending on how long you press it (pop-up emoji selector or modifier for Function keys) so that’s got to be done in the OS, not in the keyboard.


I can't stand the corner key being anything other than the control key! But luckily Apple doesn't prevent us from using third party external keyboards, at least not yet.


> I have yet to find a third-party keyboard where the Fn key works like on an Apple keyboard.

I have read that Matias keyboards have an Fn key that works this way, and also that the reason they do is that they present USB hardware IDs for Apple keyboards. macOS only allows Fn key functionality on keyboards with Apple's USB vendor ID and a corresponding product ID.

There is [a QMK issue on this subject](https://github.com/qmk/qmk_firmware/issues/2179), with some relevant comments:

> But there's a catch. And it's a big one. The keyboard's vendor and product ID need to match those of a real Apple keyboard -- probably only ones with a Fn key. The product ID also seems to determine whether certain F-keys work eg. Launchpad/Mission Control and keyboard backlighting.

and

> I emailed Matias because their boards do use the Apple identifiers. They said it’s necessary and not a problem as they’ve been doing it for decades.

and

> The Fn key behavior is defined in the macOS kernel. I haven't checked for
Big Sur but as of Catalina the Fn key was a special thing. It was defined
by a certain scan code from certain keyboards.... The only way to truly emulate the behavior of the Fn key is to either pretend to be an Apple keyboard with a fake identifier, or to have a kernel module. Karabiner Elements implements exactly such a module which is why they are able to do this.


@Micah Very interesting, thanks!

Leave a Comment