Function Key Switching with keyboard shortcut

Is there some sort of shortcut to toggle the the function keys. I have a program that uses the Fn keys a lot. I only want to use the function keys as function keys when in the program. Is there a keyboard shortcut I could set up to toggle that setting in the keyboard preferences rather than going into it every time and checking the box?

I believe you can do this with Karabiner-Elements, though it’s going to be a little technical to set up, and you might have to edit its configuration file.

1 Like

I bet you could but I was looking for something a little simpler. I have an office that uses an old windows based business system that relies on function keys. Whatever the solution would need to work for a group of users. Just a keyboard shortcut to toggle that setting.

Most of my people just stay with the function on. Being able to switch would open up MacOS to them that they are not aware of.

Thanks for the suggestion. If anyone has a solution, it is this forum.

This AppleScript will open the system preference pane, toggle the option, and close system preferences:

tell application "System Preferences" to reveal pane id "com.apple.preference.keyboard"
tell application "System Events" to tell process "System Preferences" to tell tab group 1 of window "Keyboard"
	repeat while not (exists of checkbox "Use F1, F2, etc. keys as standard function keys on external keyboards")
		delay 0.1
	end repeat
	if value of checkbox "Use F1, F2, etc. keys as standard function keys on external keyboards" = 0 then
		click checkbox "Use F1, F2, etc. keys as standard function keys on external keyboards"
	else if value of checkbox "Use F1, F2, etc. keys as standard function keys on external keyboards" = 1 then
		click checkbox "Use F1, F2, etc. keys as standard function keys on external keyboards"
	end if
end tell
quit application "System Preferences"

So you could fire this script with a keyboard shortcut using something like Keyboard Maestro, Alfred, or maybe create a quick action in automator.

1 Like

Very clever. I will try it out.
I am not much of an automator but I am an eager learner.
Thank you for this.