Riyaz Posted November 6, 2016 Posted November 6, 2016 Do you toggle "Use all F1, F2, etc keys as standard function keys" frequnetly? Now you can do it from alfred itself Based on https://apple.stackexchange.com/questions/59178/toggle-use-all-f1-f2-as-standard-keys-via-script https://github.com/riyaz/alfred-workflows/tree/master/Toggle_Fn_keys_as_standard_keys
henrik Posted December 31, 2020 Posted December 31, 2020 This doesn't seem to be working any more. 😬 Any ideas on why? 😕 Great workflow, though!
a-b Posted January 31, 2021 Posted January 31, 2021 You can use custom script like: state=$(defaults read "Apple Global Domain" "com.apple.keyboard.fnState") if ((state)); then echo "true" defaults write "Apple Global Domain" "com.apple.keyboard.fnState" "0" ## Brightness/Media else echo "false" defaults write "Apple Global Domain" "com.apple.keyboard.fnState" "1" ## F1 F2 etc fi defaults read "Apple Global Domain" "com.apple.keyboard.fnState"
a-b Posted January 31, 2021 Posted January 31, 2021 Alternatively this could be written in AppleScript to make it more future proof.
Chris Spiegl Posted February 21, 2021 Posted February 21, 2021 Does anyone have a functioning version to share? I'd love to start using this.
dipgiro Posted March 14, 2021 Posted March 14, 2021 This is still a work in progress but I think it should work with os Catalina and Big Sur on alfred_script(q) set theCheckboxBoolean to false set checkboxcompare to "Use F1, F2, etc." set i to 0 tell application "System Preferences" reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard" end tell tell application "System Events" tell process "System Preferences" tell window "Keyboard" set listCheckboxes to (entire contents as list) repeat with thisItem in listCheckboxes if class of thisItem is checkbox then set checkboxtitle to title of thisItem as text if checkboxtitle contains checkboxcompare then set theCheckbox to thisItem tell theCheckbox click theCheckbox log (its value as boolean) set theCheckboxBoolean to (its value as boolean) end tell exit repeat end if end if set i to i + 1 delay 0.04 end repeat end tell end tell end tell quit application "System Preferences" return theCheckboxBoolean end alfred_script
simoncveracity Posted June 14, 2021 Posted June 14, 2021 For anyone else trying to make this work - I've finally gotten my solution to work. The code is based here: https://github.com/MrSimonC/Toggle-Mac-Function-Keys but for brevity, here is the contents of the apple script file: -- Apple Script (i.e. Use in Apple's Script Editor Application) to Toggle Function Keys / Media keys on/off -- Tested on MacOS Big Sur (11.4) June 2021 -- Project Path: https://github.com/MrSimonC/Toggle-Mac-Function-Keys tell application "System Preferences" set current pane to pane "com.apple.preference.keyboard" end tell tell application "System Events" if UI elements enabled then tell application process "System Preferences" repeat until exists tab group 1 of window "Keyboard" delay 0.5 end repeat click radio button "Keyboard" of tab group 1 of window "Keyboard" click checkbox "Use F1, F2, etc. keys as standard function keys" of tab group 1 of window "Keyboard" end tell tell application "System Preferences" to quit else -- GUI scripting not enabled. Display an alert tell application "System Preferences" activate set current pane to pane "com.apple.preference.security" display dialog "UI element scripting is not enabled. Please activate this app under Privacy -> Accessibility so it can access the settings it needs." end tell end if end tell Hope someone finds it useful! Simon.
paulw Posted March 10 Posted March 10 I appreciate the direction to a working script, @simoncveracity! It looks like that script has been updated. It can be found here: https://github.com/MrSimonC/Toggle-Mac-Function-Keys/blob/main/Toggle Function Keys.scpt Working on macOS Sonoma.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now