Skip to content

Instantly share code, notes, and snippets.

@freszu
Created February 2, 2020 21:37
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 freszu/3317f4178361fcc633dbb9c4cb5d3f05 to your computer and use it in GitHub Desktop.
Save freszu/3317f4178361fcc633dbb9c4cb5d3f05 to your computer and use it in GitHub Desktop.
Simple bash script to toggle system preferences for Touchbar shows between "App controls" and "Show F1, F2, etc. Keys
#!/bin/bash
function readCurrent(){
local current=$(defaults read com.apple.touchbar.agent PresentationModeGlobal)
echo "$current"
}
function setCurrent(){
defaults write com.apple.touchbar.agent PresentationModeGlobal -string $1
pkill "ControlStrip"
}
functionKeys=functionKeys
app=app
current=$(readCurrent)
if [[ "$current" == "$app" ]]; then
setCurrent $functionKeys
elif [[ "$current" == "$functionKeys" ]]; then
setCurrent $app
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment