Way to switch F keys to 'application' keys and back on mac via terminal? (10.6)

4

2

Is there a command I can issue via terminal to switch my F1-12 keys to being application keys (media, screen brightness ...) and back? i.e. replicate toggling System Preferences => Keyboard => Use all F1, F2, etc. keys as standard function keys. My mac is pretty much used for browsing and music but it is nice not to have to fn to the F keys when occasionally doing some Chrome debugging.

sh54

Posted 2012-05-15T18:03:25.990

Reputation: 467

Answers

4

I only know how to do this via UI scripting. Open up AppleScript Editor, and paste the following:

tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.keyboard"
end tell

tell application "System Events"
    tell application process "System Preferences"
        click checkbox 1 of tab group 1 of window "Keyboard"
    end tell
    tell application "System Preferences" to quit
end tell

Like this:

Save it under any name you like. From a Terminal, you can then run:

osascript toggle-f.scpt

slhck

Posted 2012-05-15T18:03:25.990

Reputation: 182 472

Here's a more extensive version: http://forums.macrumors.com/showpost.php?p=15246334&postcount=8

– huyz – 2012-12-29T09:21:11.660