I am working on a iTunes Now Playing/Play/Pause touchbar widget, and I would love it if, when nothing is playing in iTunes, the Touchbar button would collapse to the icon. The only way I've figured out how to get close to this behavior is to return a space (" ") from my script. This clears the text on the button, but leaves some space to the left of the icon. I've tried returning an empty string (""), a zero-width space (U+200B), or just simply returning without a value. Nothing gets me quite where I want to be...
Anyone have any advice (or a pointer to the obvious thing I am missing)?
Thanks for the pointers! While I believe I had to use update_trigger (as opposed to update_touch_bar_widget (which afaict, doesn't accept JSON)), this was enough to get me over the finish line. My finished method looks like:
on toggleIconOnly(inputValue)
tell application "BetterTouchTool"
update_trigger "C9E548FB-B382-4BBB-A9CA-36F274A51A52" json ("{
\"BTTUUID\" : \"C9E548FB-B382-4BBB-A9CA-36F274A51A52\",
\"BTTTriggerConfig\" : {
\"BTTTouchBarOnlyShowIcon\" : " & inputValue & "
}
}")
end tell
end toggleIconOnly