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.

  • By default they have double functionality. By default those keys do the brightness adjustment and all that stuff, but if you hold down the fn key, they act like Function keys. So let's say you use an app that has a shortcut Alt + F4, to use it you'd actually press Fn + Alt + F4. Or am I misunderstanding your point? – Joonas Jan 18 '18 at 23:28
  • @Joonas "I am looking for solution without pressing fn key for one kind of functions." – Jakub Srnka Jan 19 '18 at 17:30
  • Well yea, but you also say you don't want to use a script to toggle the state on and off. You are looking for a shortcut to toggle the functionality of those keys, but you seem to reject the only two possible ways to toggle that functionality using a shortcut. What else could you possibly do? A long press? – Joonas Jan 19 '18 at 18:42
  • ...Or does @wch1zpink's answer do it exactly the way you want, except for what ever reason you don't want to use a script? I say take the solution and run. Nothing wrong about using scripts. – Joonas Jan 19 '18 at 18:49
  • Well, I tried @wch1zpink's solution and it worked. I thought I can only run AppleScript using Script Editor or exporting it as app. Creating a service and than starting that service using shortcut looks like the way to go. I need it for toggling Styles in Pages and the only shortcuts you can use are F keys. And when you want to change style after every enter it is not very enjoyable pressing fn and the F key, when you have just one hand to do it (like holding mouse with the other one...). And also I am using Brightness and Volume buttons very often. – Jakub Srnka Jan 19 '18 at 20:43

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

| improve this answer | |
  • This is the best answer, but some of the UI has changed a little in Automator. When you create a new document, you need to select "Quick Action". Then the script just shows up in your services menu. I did not test accessing it the other ways. – Ron Davis Jun 4 at 16:03

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.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .