I have a widget with an alternate color that I'd like to forcibly activate to prevent having to constantly check the value of the variable (I'm checking SystemDoNotDisturbState).
I checked the forums and so far have only found this related discussion, which sounds like the same issue I'm seeing. However, the doc page provided 404s and I don't see a direct way to approach the issue on the new Applescript docs page.
I can find ways to perform update_trigger, but the issue I see with that method is that I can't retain both the original color and background color on the trigger itself. So any future updates to DND would not synchronize the color properly, I believe.
I also see update_touch_bar_widget that might work for this, but even when I try to set all of the params, the button just disappears and returns in a few seconds. It's also unwieldy to set the icon_data param via script.
The easiest way would probably be to use the refresh_widget function. It will execute the scripts assigned to a widget and update its content.
If you set the standard repeat rate of the script to 0 (never), and only update it using the refresh_widget function it should achieve the desired effect.
Thank you for the help, @Andreas_Hegenberg. I had tried refresh_widget yesterday via Applescript and it does not throw any errors, but the widget still seems to operate on its own update schedule (currently 10s). I tried it again today and played with async vs blocking, but the same behavior occurs.
The only thing I can guess is that my trigger isn't set up to properly calculate itself. Would it be helpful to copy the trigger here?