Replacing Apple's Function Keys Only for the Active App

I downloaded Keyboardmaestro and try to do some first steps. First I want to customize the keyboard for only one specific app and replace to standard functionkeys of apple F1 to F12 for brightness, dashboard and so on by specific actions. What have I to do, that as soon that this specific app is active, the standard functions are deactivated and vice versa ?

Hey guys - nobody really has an answer, it can't be that difficult :slight_smile: or is it ?

For replacing the behaviour of hardware keys, you need to go lower than Keyboard Maestro, and use a tool like Karabiner.

Keyboard Maestro can remap regular keys (including function keys) using hot keys, but hardware keys like brightness cannot be remapped with the hot key API. (not that the Fn modifier behaves as a kind of hardware toggle, making a single key act like two different keys - Keyboard Maestro can remap the key when it behaves like a function key, but not when it behaves like a hardware key, even if it is the same physical key).

Hmm .. I am currently using Better Touch Tools, I started with BTT because I have a Macbook Pro with a touch bar. But since I use an external monitor, I also use a normal external Apple keyboard and no longer need the touch bar. BTT can be easily configured with the touch bar, but some extended features of the touch bar for the keyboard are missing. Funnily enough, the use of normal behavior of the keys (F1 .. F12) can be configured in BTT for a single app without changing the apple settings. So I thought that Keyboard Maestro can do the same. By the way - I've looked at Karabiner, but that's a terrible solution.

Hey @ilreberli,

Better Touch Tool does many things Keyboard Maestro will never do.


In part because Keyboard Maestro uses only public APIs. Which is why Keyboard Maestro back to version 4.x runs a decade later on Big Sur for example. Apple does not always make their APIs public for useful technologies.


Using the AppleScript from another thread—a script designed to toggle the Function Keys setting in the background then briefly display a notification—a macro like the one shown below seems to work on my 10.11 (OS X El Capitan system). Note, the same script is just being used twice since it is just toggling the Function Keys setting on/off without checking the on/off setting beforehand.


The AppleScript code can be found in the linked thread.

For a similar capability, there's this thread:

I have not tested that in any way but did find it while searching for the thread I linked above.

I have done this for many years and I'm quite happy with it:

@peternlewis : don't be too modest :wink: For replacing the behaviour of hardware keys, you need to use Keyboard Maestro.


Hi @ilreberli I use the app Flour for this:

The advantage is that you can define for each app on your Mac whether the FN keys should be enabled or disabled.



Looks great. Too bad it's not functional on Monterey.