Currently, we can set a TouchBar button running AppleScript, that auto-refresh every N seconds. It's great, but for some use-cases it's not ideal. I would love to see a Predefined Action to re-execute the script of a TouchBar button (to update it). Basically, we would just have to enter the name of the button, and trigger the action with whatever trigger.
Here is my use case :
I've configured an indicator next to the Now Playing widget. Linked with Spotify API, it informs if the song has already been added to the Saved Songs. It looks like this :
I've set the button to refresh every 5 seconds. But it means that I made a call to Spotify API every 5 seconds, which is not great…
If there was a Predefined Action to refresh the script of a TouchBar button, I would map the event
Receive Distributed Notification with
com.spotify.client.PlaybackStateChanged value, to refresh my button.
This notification is sent every time there is change state on spotify (play/pause/next/previous…), so it makes sense to only refresh the button on this time.
What do you think ? Would it be hard to implement ?