would it be possible to add something like "toggle_touch_bar_widget" to the AppleScript commands that takes a UUID and a boolean, so one could either enable or disable a specific widget via AppleScript?
As far as I've been able to find out, currently I can only use "update_touch_bar_widget" and "refresh_widget" to interact with Touchbar widgets. Neither can be used to enable/disable widgets to my knowledge.
Using "update_touch_bar_widget" to set the text to an empty string will result in the widget not being shown, but only for widgets that don't have the "Show only icon, no text" option set. I'm using a lot of fancy little widgets that only make use of icons and alternate colors/icons to inform me about certain things, and many of them need only to be shown at certain times. I was not able to figure out any way to hide them via AppleScript (or even via BTT actions, for that matter, because in that case I could just create a named trigger and call that from my AppleScript).
Did I miss something or is what I'm trying to achieve really not possible at the moment?