Switch logo with code not return value?

Is it possible to change the icon with code and not based on the return value.
I've got a widget set up that checks Spotify and iTunes for a track playing and then displays that track (it's a fairly common script floating around), however, I'd like the icon to show either Spotify's icon or iTunes.

Obviously, the return value is the name of the track, so changing on that won't work. Can it be changed any other way? Or is there a way to pass a return value just to BTT?

In recent versions of BTT you can also return a json value instead of just a string, so you could return the itunes or spotify icon from your script.

Maybe try version 2.406 alpha.

In Apple Script the return would look like this:

return "{\"text\":\"newTitle\",
\"icon_data\": \"base64_icon_data\", 
\"icon_path\":\"path_to_new_icon\", 
\"background_color\": \"255,85,100,255\"}"

Alternatively you can update the logo using the scripting functions https://docs.bettertouchtool.net/docs/apple_script.html update_touch_bar_widget

1 Like