Skip to content

Give the built-in keyboard Print and keyboard backlight keys - #6

Draft
maralcbr wants to merge 1 commit into
mainfrom
port/683-builtin-keyboard-keys
Draft

maralcbr wants to merge 1 commit into
mainfrom
port/683-builtin-keyboard-keys

Conversation

@maralcbr

@maralcbr maralcbr commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Implements omacom/omarchy-mac#683. Omarchy binds screenshots to Print and the keyboard backlight to XF86KbdBrightness*; a MacBook keyboard has neither key. A udev hwdb remap for the built-in keyboard only (Apple SPI Keyboard on M1, Apple MTP keyboard on M2+) makes F4 Print and F5/F6 keyboard backlight down/up, so Omarchy's own binds work with no Mac Hyprland binds.

Also drops omarchy-mac-external-displays.service's ordering on omarchy-drive-recover.service, which no longer exists (#683's cleanup list).

Draft until checked on hardware. Not yet verified:

  • the HID usages (7003d-7003f) and evdev names the M1 and M2 keyboards report (evtest / libinput debug-events, with and without Fn);
  • that hid_apple's Fn translation leaves the remapped keys alone. As written, the three keys send Print/backlight with or without Fn, so F4-F6 are lost as F-keys on the built-in keyboard;
  • F4 vs F3 for Print is a choice.

F6 overlaps #4 (moon key, from omacom/omarchy-mac#646).

Tested: new omarchy-mac/test/keyboard-keys-test.sh compiles the hwdb with systemd-hwdb --root and checks that only the built-in keyboard names match. omarchy-mac/test/all and omarchy-mac-boot/test/all pass in an ALARM aarch64 container.

Omarchy binds screenshots to Print and the keyboard backlight to
XF86KbdBrightness, and an Apple Silicon MacBook's keyboard has neither key.
A udev hwdb remap for the built-in keyboard only (Apple SPI on M1, Apple
MTP on M2 and later) turns F4 into Print and F5/F6 into keyboard backlight
down/up, so Omarchy's own binds work with no Mac-specific Hyprland binds.

The first boot-time display unit also drops its ordering on
omarchy-drive-recover.service, which no longer exists.

Implements omacom/omarchy-mac#683.
@scottjones

Copy link
Copy Markdown
Collaborator

Tested on M2 hardware: 14" MacBook Pro M2 Max (j414c), kernel 7.1.12-2-11.31-sep-ARCH. The hwdb was loaded from /etc/udev/hwdb.d, then systemd-hwdb update and udevadm trigger on the keyboard.

  • Device name and usages: the built-in keyboard is Apple MTP keyboard, and F4/F5/F6 report MSC_SCAN 7003d/7003e/7003f with or without Fn. udev attached all three KEYBOARD_KEY_* properties.
  • Before: without Fn they send KEY_SEARCH, KEY_MICMUTE and KEY_SLEEP; with Fn, KEY_F4-KEY_F6.
  • After: they send KEY_SYSRQ, KEY_KBDILLUMDOWN and KEY_KBDILLUMUP with and without Fn. hid_apple leaves them alone. F4 opens Omarchy's screenshot tool, and F5/F6 dim and brighten the keyboard backlight with its OSD.

Two things to weigh:

  • F5 is a working mic-mute key today (Omarchy shows the mic on/off OSD), and the remap replaces it with backlight down.
  • Removing the hwdb file and re-triggering udev does not undo the remap: the kernel keymap keeps the codes until the device is re-created (reboot), and I had to restore them with EVIOCSKEYCODE. Package removal, or a later version that changes a key, behaves the same way, which may be worth a line in the README.

Not tested: M1 (Apple SPI Keyboard).

fbalazsy added a commit to fbalazsy/omarchy-m4 that referenced this pull request Oct 24, 2026
omarchy-mac's main ships no remap for the missing keyboard-light keys yet:
it is tracked in omacom/omarchy-mac#683, and the hwdb remap is only the
draft omacom/omarchy-mac-pkgs#6. Drop 90-m4-keyboard.hwdb and its test, so
the J616s keyboard behaves as omarchy-mac does today. The SHIFT + brightness
rebind stays gone: SHIFT + F1/F2 are Omarchy's display minimum/maximum.

@scottjones scottjones left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We went through this again against current main. It still merges cleanly, and omarchy-mac/test/all, omarchy-mac-boot/test/all and the new keyboard-keys-test.sh pass on the merged tree. The new test catches what it should: dropping the MTP line, changing a key, widening the match to Apple* or removing the file each make it fail.

Tested on M3 hardware: 13" MacBook Air M3 (J613), linux-aurora 7.2.11.aurora8-1. We installed the hwdb from 99fac5c in /etc/udev/hwdb.d, then ran systemd-hwdb update and udevadm trigger.

  • The built-in keyboard is Apple MTP keyboard, as on M2, so the existing match covers it. The backlight LED is kbd_backlight (max 255) and lights with brightnessctl before the remap.
  • Before: without Fn, F4/F5/F6 report MSC_SCAN 7003d/7003e/7003f and send KEY_SEARCH, KEY_MICMUTE and KEY_SLEEP, the same as M2. We didn't capture the Fn presses.
  • After: F5 and F6 dim and brighten the keyboard light, and F4 opens Omarchy's screenshot tool.

The README and description could name the M3 Air next to M2 as tested. "M2 and later" in omarchy-mac/README.md:53 already covers it.

Still open from our M2 Max run:

  1. omarchy-mac/README.md:53 says the remap applies from the next boot or udevadm trigger, but nothing goes back on udevadm trigger. After removing the package, or a later version that drops a key, the kernel keeps the old codes until the keyboard is re-created (a reboot). We'd add a line saying a reboot is needed after removal or a dropped key.

  2. F5 is a working mic-mute key today, and with this change it becomes backlight down. That's a choice, not a bug, but it should be a deliberate one. If we keep it, we'd mention in the README that the mic key is gone on the built-in keyboard.

  3. Fn+F4 to F6 no longer send F4 to F6 on the built-in keyboard, as the description says. A hwdb remap can't tell Fn apart (the scan code is the same either way), so this comes with the approach. README:53 says they send these with or without Fn; worth saying outright, next to the fnmode section, that F4 to F6 are gone as F-keys on the built-in keyboard.

Small ones: on main, omarchy-mac/README.md:23 points at this PR as "in review", and README.md:38 describes the moon key as KEY_SLEEP for the logind drop-in from #4. With this PR F6 on the built-in keyboard is backlight up, so that line should say so (the drop-in still matters for other keyboards or after removal).

The omarchy-drive-recover.service cleanup in omarchy-mac-external-displays.service looks right: nothing else on main ships or references that unit.

M1 (Apple SPI Keyboard) is still untested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants