Change touch bar settings programmatically via Terminal in MacOS High Sierra

Viewed 782

I'd like to be able to toggle between 'Touch bar shows F1, F2, etc keys' and 'Touch bar shows expanded control strip' using defaults.write

I've tried the following:

  1. I saved 'defaults read' to a file, changed the touch bar setting, then saved 'defaults read' to another file, then compared the two files to see the differences.
  2. The only difference seems to be that com.apple.touchbar.agent PresentationModeGlobal switches between fullControlStrip and functionKeys

However, when I apply that change successfully using defaults write com.apple.touchbar.agent PresentationModeGlobal functionKeys, it doesn't change my touch bar.

Is there a reason defaults write isn't having the desired effect?

1 Answers

You've gotten it correct. All that's left to do is to restart the touch bar.

pkill "Touch Bar agent"; killall "ControlStrip";
Related