Skip to content

Instantly share code, notes, and snippets.

@mcandre
Created June 25, 2025 20:49
Show Gist options
  • Save mcandre/9ee1ecfde778b60ce6a11a207f39758c to your computer and use it in GitHub Desktop.
Save mcandre/9ee1ecfde778b60ce6a11a207f39758c to your computer and use it in GitHub Desktop.
macOS Toggle Keyboard Function Keys

macOS Toggle Keyboard Function Keys

Apple does not make it easy to very rapidly toggle between the two F1 - F12 vs. Brightness - Volume Up keyboard modes.

Fortunately, this can be automated via the Shortcuts scripting system.

Run Shell Script

defaults write -g com.apple.keyboard.fnState -int $(( ! "$(defaults read -g com.apple.keyboard.fnState -int)" ))
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u

We've published this as a premade Shortcut script / widget / menulet.

DOWNLOAD

https://github.com/mcandre/dotfiles/blob/main/src/toggle-function-keys.shortcut

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