Function keys function toggle

Is there any shortcut for toggling what funtion keys (F1, F2, F3,…) do? I sometimes want them to do the special operations (eg. brightness) and sometimes use them for toggling things in Pages (you can set shortcut for Style etc.).

I am looking for solution without pressing fn key for one kind of functions. I know I can do some scripting and make little AppleScript app for toggling it but that's the last solution.

I have non Touchbar MacBook Pro running macOS Sierra 10.12.6, if that helps.


Solution 1:

This works for me using the latest version of Sierra and 15 inch MBP (non-touch bar)

Using Automator, create a new file and choose “New Service” as your option

Add A “Run AppleScript command” to your workflow, and insert the following AppleScript code

tell application "System Preferences"
    reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
end tell
tell application "System Events" to tell process "System Preferences" to tell window 1
    click checkbox "Use F1, F2, etc. keys as standard function keys" of tab group 1
end tell
quit application "System Preferences"

enter image description here

Save your new Automator service, naming it something like... "Toggle Function Keys"

Next, just open System Preferences/Keyboard/Shortcuts/Services And you should see your new "Toggle Function Keys" service Located in the "General" sub-menu And assign it a Keyboard shortcut.

enter image description here

Your new service can now be activated using the keyboard shortcut you created and in the "Services" menu while using any application.

enter image description here


You also have another option.

You own a Mac! It's a very powerful tool which is supposed to make your life easier. So make your life easier and let your Mac do your work for you.

If you are crazy lazy like I am, you can save that AppleScript code in my answer, in the script editor app as a script and name it something like “Toggle Function Keys.scpt”. You can make the action of toggling your function keys on and off “speakable”. Meaning you can run the script with a dictation command.

Here’s the process...

Enable enhanced dictation and dictation commands in your system preferences.

enter image description here

As you can see in my next image, I set “computer” as my keyword phrase...

enter image description here

Now with enhanced dictation ready to rock'n roll, I selected the “Toggle Function Keys.scpt” file in Finder and spoke the phrase “computer make this speakable”

Speaking that command opened up this dialog box

enter image description here

Now any time I want to toggle my function keys, I simply say the command “Computer Toggle Function Keys” and it runs “Toggle Function Keys.scpt” and performs all the actions in that script file

Solution 2:

I recommend BetterTouchTool, a little menu bar app that I have relied on for years. With it, you could either create universal shortcuts with or without modifier keys, or create application-specific shortcuts so the functions are determined by whichever application is frontmost. Because the F-keys are special, if you encounter controversial behavior, check System Preferences > Keyboard > Shortcuts and disable the shortcuts that hinder your own mappings. I haven't overwritten my F-keys so I can't remember if remapping them with BetterTouchTool causes controversy or not, but if it does, see System Preferences. It's easier to keep track of what functions dominate if you can aim to keep all the rules in one place.