Tell me more ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I toggle the "Use all F1, F2 as standard keys" setting very often and would like to automate it via a script (or a keyboard shortcut). Is it possible? I've tried to Google the right arguments for defaults write ... but unsuccessfully.

fn settings

share|improve this question

2 Answers

up vote 1 down vote accepted
tell application "System Preferences"
    reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
end tell
tell application "System Events" to tell process "System Preferences"
    click checkbox 1 of tab group 1 of window 1
end tell
quit application "System Preferences"

You could also use defaults write -g com.apple.keyboard.fnState -bool, but I don't know any way to apply the changes without logging out and back in.

share|improve this answer
Exactly what I was looking for, thanks. – jkbr Aug 12 '12 at 15:08
I've packed this script as an app using Automator so that it can be quickly run from Spotlight: github.com/jkbr/macos-fn-toggle – jkbr Feb 21 at 19:06

Some AppleScript that might help: Applescript to toggle F1-F11 keys as function keys - MacRumors Forums

share|improve this answer
Welcome to Ask Different! You've posted this as an answer, which is only for things that directly answer the question asked. Answers on Ask Different need to be more than just a link. It's okay to include a link, but please summarize or excerpt it in the answer. The idea is to make the answer stand alone. Please take a look at the FAQs for more info. Thanks. – Nathan Greenstein Aug 12 '12 at 15:48

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer: please explain why you're recommending it as a solution. Answers that don't explain anything will be deleted. See Good Subjective, Bad Subjective for more information.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.