Add `visible` option (true/false) for AppleScript `update_touch_bar_widget`

I'd like more flexibility for dynamically hiding/showing specific buttons based on the context of my environment (apps or files open, processes running, room presence of my house, geolocation, etc). Being able to update the visibility setting of buttons/widgets via the AppleScript function would enable some very creative scripting!


This is already possible. I have done it last week. But I finally moved to a touch bar group for what I was doing so I do not have a working example.

But you should try a following of
update_trigger "UUID" json "{ "BTTEnabled2" : 0}



1 Like

This works, perfect! Thank you! :grinning:

Just wanted to reply but @oliviermattelaer was faster :slight_smile:

In general update_trigger can update all the basic, static properties of any trigger in BTT (not only touch bar triggers).
update_touch_bar_widget is only used for updating the visible content of a touch bar widget (although probably the visibility state would also fit in there)

Hi, do you know how to get properties of BTT triggers/widgets? I've looked through the dictionary of BTT but no luck.

What I want to accomplish is to toggle the visibility of touch bar items, that's why I need to know the current status and then set the opposite value.

If it's not possible I guess I have to use BTT variables as a workaround.

Getting the config of a trigger via Apple Script is currently not possible but probably something I should add!

could be really nice indeed

nice! looking forward to it!

Added something in the latest build get_trigger:

I definitely recommend to use it with the new "Source Type: Real JavaScript", because working with JSON is much easier there.

Example usage:

async function enabledState() {
	let trigger = await callBTT('get_trigger', {uuid: '0BD520F3-EB38-4832-92C2-940D194248EA'});
	let json = JSON.parse(trigger);

1 Like

That's a game changer :slight_smile: