I'm not entirely sure if this is a bug or just me not understanding scripting... But here goes:
Describe the bug
I'm trying to update a widget's icon via AppleScript. If I use...
tell application "BetterTouchTool"
update_touch_bar_widget "FC72A1C1-81BA-4028-8332-99F258F0C2F9" icon_path "~/Pictures/Touch Bar Icons/Battery/100.png"
end tell
... the widget completely disappears from the Touch Bar, making nearby icons kind of crash into one another. Disabling and re-enabling the widget then restores the proper configuration, with the icon properly updated (!!).
If I use...
tell application "BetterTouchTool"
update_touch_bar_widget "FC72A1C1-81BA-4028-8332-99F258F0C2F9" icon_path "~/Pictures/Touch Bar Icons/Battery/100.png"
refresh_widget "FC72A1C1-81BA-4028-8332-99F258F0C2F9"
end tell
... it works more or less as expected, but the icon flickers each time it is updated, as do the ones next to it. I presume refresh_widget just does quickly what a manual disable/re-enable does slowly.
Am I doing something wrong? I thought update_touch_bar_widget was supposed to suffice to update an icon.
Affected input device (e.g. MacBook Trackpad, Magic Mouse/Trackpad, Touch Bar, etc.):
Touch Bar
Also, the path is definitely recognized – as is the UUID – since the icon is updated to whatever path I specify. It's just that I don't see it at first because the icon disappears – I must bring it back by means of refresh_widget or a manual disable/enable to see it.
Also waiting for a reply here. Still same behavior with 2.645 and macOS 10.13.6. The widget/icon disappears from the Touch Bar if only update_touch_bar_widget is used, and it flickers if used conjunction with refresh_widget.
update_touch_bar_widget only works with the Apple Script or Shell Script widget. Are you using any of them? Otherwise you'd need to use the update_trigger function
Andreas, could you please also have a look at my original issue? Just see the first post in this thread. I can't for the love of it figure out what I'm doing wrong. My scripting target is definitely a widget, but the disappearing/flickering issue means I have to update the icon as little as possible, otherwise I get constant movement in my Touch Bar. That can't be how it's supposed to work!
I already had the widget on "icon only", though. (And it already had a title/text.) So this still seems like a bug to me. But of course it's workable now.
if possible please go to the about tab in BetterTouchTool and click the "export debug information" button. This will create a folder called BetterTouchToolDebug on your desktop, if you send that to me I may be able to see what's wrong (andreas@folivora.ai)
I think there was some confusion as to what I refer to as Script Widget
You just have normal buttons set up and assigned scripts that are triggered when they are pressed.
Widgets are added using the + Widget/Gesture button in BTT. The point of script widgets is that they run a script to determine what they display.
If you want to update a normal button/trigger (which usually just shows static text) you can use the update_trigger function like this: