omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

fnmode=2 is forced on every install: a no-op for the keyboards it names, and it removes the media keys on Apple keyboards

Open omarchybot opened this issue 3 months ago • 1 comments

System details: Omarchy quattro @ 7488eade (post-4.0.0), QEMU/KVM VM. Found by an automated QA pass; drop-in confirmed present on a stock 4.0.0 worker. Not reproduced on Apple hardware — no Apple HID keyboard on the test machine.

install/hardware/fix-fkeys.sh writes options hid_apple fnmode=2 on every Omarchy install, with no hardware gate:

# Ensure that F-keys on Apple-like keyboards (such as Lofree Flow84) are always F-keys
if [[ ! -f /etc/modprobe.d/hid_apple.conf ]]; then
  sudo mkdir -p /etc/modprobe.d
  echo "options hid_apple fnmode=2" | sudo tee /etc/modprobe.d/hid_apple.conf >/dev/null
fi

Confirmed on a stock worker:

$ cat /etc/modprobe.d/hid_apple.conf
options hid_apple fnmode=2
$ modinfo hid_apple | grep -i fnmode
parm: fnmode:Mode of fn key on Apple keyboards (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst, [3] = auto, 4 = fkeysdisabled) (uint)

The kernel default is 3 (auto), and auto already does what this script wants — drivers/hid/hid-apple.c:

	if (fnmode == 3) {
		if (asc->quirks & APPLE_DISABLE_FKEYS)
			real_fnmode = 4;
		else if (asc->quirks & APPLE_IS_NON_APPLE)
			real_fnmode = 2;
		else
			real_fnmode = 1;
	}

So for the third-party Apple-alike keyboards the comment names (Lofree Flow84 and friends, which carry APPLE_IS_NON_APPLE) auto is already 2 and the drop-in changes nothing. The only keyboards it actually changes are the ones it was not aimed at:

  • Genuine Apple keyboards (MacBook internal keyboards, Magic Keyboard) go from 1 (fkeyslast — brightness/volume/media on the top row) to 2, so brightness, volume and media now need Fn held. That contradicts manual/33-monitors.md:47 ("Monitor brightness is controlled by the dedicated function keys for brightness up/down") on hardware Omarchy explicitly supports (manual/44-mac-support.md, the whole T2 path in install/hardware/apple/).
  • Keyboards the kernel flags APPLE_DISABLE_FKEYS are forced out of mode 4 into 2.

Possibly related lead: on a T2 Mac the Touch Bar registers as an Apple HID keyboard and its keycodes pass through the same hid_apple translation. #2837 (MacBookPro16,1: Touch Bar always sends F1–F12 regardless of hid_appletb_kbd mode=2) is exactly the symptom fnmode=2 produces — worth having that reporter try fnmode=3 before chasing the Touch Bar driver.


Correction, after an independent review of this report:

The Touch Bar lead is wrong -- disregard it. The Touch Bar binds to hid_appletb_kbd, a separate driver with its own mode parameter, and #2837 explicitly distinguishes it from hid_apple. The rest stands: the drop-in is a no-op for the kernel-recognised Apple-alike keyboards it names, and it does move genuine hid_apple keyboards off their media row. It does not cover every MacBook keyboard.

omarchybot avatar Aug 16 '26 11:08 omarchybot

Checked against quattro at 902fd8ae and the current kernel's drivers/hid/hid-apple.c. Nothing was run: the effect depends on Apple and Apple-mode keyboards, which no worker has, so this rests on reading the source. The second opinion (Codex Medium) checked the same claims separately and reached the same conclusions, which are not guaranteed to be independent of mine. It also contributed the corrections to the Touch Bar keyboards and to "removes" below.

Partly correct, and partly overstated:

  • Correct: install/hardware/all.sh:8 runs install/hardware/fix-fkeys.sh on every install, with no hardware gate. It writes options hid_apple fnmode=2 unless /etc/modprobe.d/hid_apple.conf already exists, and no migration removes it. On a genuine Apple keyboard handled by hid_apple, auto (fnmode=3) would resolve to 1, so the drop-in moves brightness, volume and media behind Fn. They are not removed: they still work with Fn held.
  • Not established: that the drop-in is a no-op for the Lofree Flow84. Auto resolves to 2 only for keyboards with APPLE_IS_NON_APPLE, and that quirk is set by a case-sensitive prefix match on the HID name against non_apple_keyboards[] (hid-apple.c:359-389). Lofree is not on that list. Unless the Flow84 reports one of the generic names there, it resolves to 1 under auto and the drop-in is what gives it F-keys first. Nobody has checked the name it reports.
  • Different from described: the seven T2 keyboards flagged APPLE_DISABLE_FKEYS (hid-apple.c:1186-1205) resolve to 4 under auto. Forcing 2 enables Fn plus the number row as F1–F12 on them. It does not move a media row.

fnmode is a single module-wide parameter, not a per-keyboard one. So no setting gives a Lofree F-keys first and a MacBook's built-in keyboard media keys first, and a "this is a Mac" gate decides wrongly whenever both are attached. Every fix (removing the drop-in, gating it on Apple hardware, or keeping it) chooses what an Apple keyboard's top row does by default. That is the maintainer's decision, so no fix pull request was opened. The Apple Silicon gate in #14431 (also carried in #14483 and #14250) leaves Intel and T2 Macs and external Magic Keyboards as they are.

Waiting on the maintainer to decide the default.

omarchybot avatar Oct 08 '26 06:10 omarchybot