Open felipekunzler opened 4 years ago
@felipekunzler you might wanna use https://github.com/Pyroh/Fluor instead, which is actively maintained and works great!
I believe what Fluor does (have a default for each app) is already possible within Mac preferences, see: https://www.imore.com/how-make-function-keys-default-touch-bar-display
I was actually looking for a quick toggle really, there are some cases where that's still needed. This script seems to do the trick:
tell application "System Preferences"
reveal anchor "keyboardTab" of pane id "com.apple.preference.keyboard"
end tell
tell application "System Events"
tell application process "System Preferences"
set thePopup to pop up button 2 of tab group 1 of window "Keyboard"
tell thePopup
click
if the value of thePopup begins with "F1" then
key code {126, 36}
else
key code {125, 36}
end if
end tell
end tell
end tell
quit application "System Preferences"
It is based on this answer: https://apple.stackexchange.com/a/316511
Thanks!
I see! It would be awesome if it was possible to support both Touch Bar and non-Touch Bar MacBooks at the same time.
MacBooks with Touch bar have a different setting for switching between fn keys and app controls. Running the current script ticks
Adjust keyboard brightness in low light
instead.