Skip to content

Make the Mac's moon key toggle Do Not Disturb instead of suspending - #646

Open
nosferatuboi wants to merge 1 commit into
omacom:quattro-upstreamfrom
nosferatuboi:fix/apple-f6-do-not-disturb
Open

nosferatuboi wants to merge 1 commit into
omacom:quattro-upstreamfrom
nosferatuboi:fix/apple-f6-do-not-disturb

Conversation

@nosferatuboi

Copy link
Copy Markdown

On a MacBook, one tap of the top row's moon key (F6, Do Not Disturb in macOS) suspends the Mac. The kernel reports that key as KEY_SLEEP, and logind's default HandleSuspendKey=suspend acts on it. Omarchy already takes the power key from logind (HandlePowerKey=ignore) but not the sleep key. Found on a MacBook Air M1 (J313): systemd-logind: Suspend key pressed short. → Suspending....

What changed, all in omarchy-mac, so other machines' Sleep keys keep suspending:

  • vendor/systemd/logind.conf.d/20-omarchy-mac-sleep-key.conf sets HandleSuspendKey=ignore and HandleSuspendKeyLongPress=ignore. It installs to /usr/lib/systemd/logind.conf.d, so a same-name /etc drop-in still wins. It takes effect from the next boot or logind reload; setup still restarts nothing.
  • apple.lua binds XF86Sleep to omarchy-toggle-notification-silencing alongside the other Mac default bindings, so omarchy_default_bindings = false drops it too.
  • Tests: apple-platform-hooks-test.sh asserts that the Mac binds the moon key and that no other machine does. The package's systemd-test.sh asserts that the staged drop-in is present. The new hook assertion fails with the bind removed.
  • README: the moon key is added to the apple.lua defaults.

Tested on the MacBook Air M1 (linux-asahi 7.1.13, Hyprland 0.56.2):

  • Before the change: F6 suspended the Mac (s2idle), as described above.
  • With the drop-in in place and logind reloaded, HandleSuspendKey reads "ignore". Across about 10 F6 presses, logind logged each Suspend key pressed short. and made no suspend entry.
  • With the bind added to the running session (hyprctl eval, the same hl.bind path apple.lua goes through), F6 toggled the Do Not Disturb indicator. One physical press gives one key event, so it doesn't flicker. omarchy-toggle-notification-silencing flips the state off → on → off.
  • packages/omarchy-mac/test/all and test/shell.d/apple-platform-hooks-test.sh pass.

🤖 Generated with Claude Code

@maralcbr

Copy link
Copy Markdown
Member

Thanks, this is still wanted. This week the Mac code moved into the omarchy-mac package and the platform files moved to the /usr/share/omarchy-platform root (#660): apple.lua now lives at packages/omarchy-mac/share/omarchy-platform/hypr/defaults/apple.lua. Could you rebase onto quattro-upstream? packages/omarchy-mac/README.md and test/shell.d/apple-platform-hooks-test.sh also conflict.

The MacBook top row's moon key (F6) is Do Not Disturb, but the kernel
reports it as KEY_SLEEP and logind suspends on it by default, so one tap
puts the Mac to sleep. omarchy-mac now ships a logind drop-in that ignores
the sleep key and binds XF86Sleep to Do Not Disturb on Apple Silicon.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nosferatuboi
nosferatuboi force-pushed the fix/apple-f6-do-not-disturb branch from 07cce3a to c5fd503 Compare September 30, 2026 05:56
@nosferatuboi

Copy link
Copy Markdown
Author

Rebased onto quattro-upstream. The bind is now in packages/omarchy-mac/share/omarchy-platform/hypr/defaults/apple.lua, and the README and apple-platform-hooks-test.sh conflicts are resolved on top of the #660 versions. I also updated the path in the logind drop-in's comment. packages/omarchy-mac/test/all and the hooks test pass here.

This branch has not been deployed

No deployments
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