fn-toggle.app programmatically toggles the
"Use all F1, F2, etc. keys as standard function keys"
option in macOS System Preferences. A task that is tedious
when done manually, which especially keyboard-heavy users,
such as programmers, tend to do very often.
All it does is that it executes this AppleScript snippet through an Automator-created app:
tell application "System Preferences" reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard" end tell tell application "System Events" to tell process "System Preferences" click checkbox 1 of tab group 1 of window 1 end tell quit application "System Preferences"
make install which installs the following files:
/Applications/fn-toggle.app— the app containing the script that toggles the setting.
~/Library/Services/fn-toggle.workflow— a service that allows
fn-toggle.appto be invoked with a keyboard shortcut.
(You can run
make clean to remove those files again.)
In OS X 10.9 (Mavericks) and later, you also need to:
- Open the
fn-toggleapp once either from spotlight or from
Applicationsfolder (it will do nothing but it's needed for the app to appear in the accessibility menu in step 3)
- Go to
Security & Privacy>
Click the lock to make changesand tick
Allow the apps below to control your computer.
Run the app. The fastest way to do it is from Spotlight:
⌘ + space(or similar) to open Spotlight.
fn-toggle.appshould be the Top Hit.
Enable Keyboard shortcut
- Go to
General(at the end of the list) and assign a new shortcut to