Skip to content

Instantly share code, notes, and snippets.

@kemar
Created May 28, 2023 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kemar/3743b6eadeb21141420fccd5990779ca to your computer and use it in GitHub Desktop.
Save kemar/3743b6eadeb21141420fccd5990779ca to your computer and use it in GitHub Desktop.
AppleScript pour commuter "Utiliser les touches F1, F2 etc. comme des touches de fonction standard" dans Réglages Système (Ventura)
-- osascript toggle_function_keys.scpt
-- Inspired by https://github.com/MrSimonC/Toggle-Mac-Function-Keys
open location "x-apple.systempreferences:com.apple.Keyboard-Settings.extension"
tell application "System Settings"
reveal anchor "FunctionKeys" of pane id "com.apple.Keyboard-Settings.extension"
end tell
tell application "System Events" to tell process "System Settings"
set checkbox_target to false
-- Set up an infinite loop to wait for the checkbox to appear in the UI.
repeat
try
set checkbox_target to (checkbox "Utiliser les touches F1, F2 etc. comme des touches de fonction standard" of group 1 of scroll area 1 of group 2 of splitter group 1 of group 1 of sheet 1 of window 1)
end try
if checkbox_target is not false then
exit repeat
end if
end repeat
click checkbox_target
if (value of checkbox_target as boolean) then
display notification "Touches de fonction standard activées"
else
display notification "Touches de fonction Mac activées"
end if
-- Close pane "com.apple.Keyboard-Settings.extension" by pressing the ESC key.
key code 53
end tell
delay 1
tell application "System Settings" to quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment