Replacing Apple's Function Keys Only for the Active App

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.

image

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.