Display the currently playing track in iTunes/Spotify on the Touch Bar

Ever since I got my 2016 15″ MacBook Pro with Touch Bar, I wanted to have it show one thing: the currently playing track. Today, thanks to the amazing Better Touch Tool and some Apple Script (which I don’t like, but it gets the job done), I finally have that functionality.

It’s really easy:

  1. Open Better Touch Tool and click on the Touch Bar section.
  2. Add a widget and select the “Run Apple Script and Show Return Value” option.
  3. Click on the “Advanced Configuration” button and paste the relevant Apple Script (see below).
  4. Optional: set the Predefined Action to “Open Application / File / Apple Script …” and select iTunes/Spotify: this will always bring iTunes/Spotiy to the foreground when you tap the widget.
  5. Optional: set the iTunes/Spotify icon as the widget’s icon (You can right click on the .app bundle, click on “Show Package Contents”, then go to Contents/Resources. The icones are respectively iTunes.icns and Icon.icns, just drag them over their spot in BTT.)

Here is the script for iTunes:

And here is the one for Spotiy:

The only difference between the two is the name of the app in the first if and in the tell statement.

Better Touch Tool hides the widget if the Apple Script returns nothing (which is the case when the music is paused or when the iTunes/Spotify are closed): you can work that around by replacing the two return "" with return " ", i.e. returning a space when nothing is playing. It’s not very aesthetically pleasing on the Touch Bar because the button is asymmetric, but you can do that if you prefer it that way.

9 thoughts on “Display the currently playing track in iTunes/Spotify on the Touch Bar

  1. Grazie per gli ottimi script…. D’altronde bisogna aggiustarsi con BTT dal momento che praticamente nessuna App si sta adattando alla nuova TB…

  2. Pingback: EasyApple #297: L'utilizzatore di giga - EasyPodcast

  3. Great tip.

    If I press the cross to the left of the widget, it disappears. I find that I have to go into “advanced configuration” and press save, then it’s back.

    Is there a better way of restoring the widget if closed? Or perhaps set it up permanently?

    • That’s a feature of BTT, as it allows you to dismiss its custom Touch Bar to reveal the system/app one. You can however define a shortcut in BTT that launches the action “Toggle BetterTouchTool Touch Bar” to quickly show/hide it.

  4. Pingback: How to display iTunes or Spotify now playing on a Mac TouchBar

  5. hello, when I put the script in, and run script. after which I save but when I look one touch bar it just says the name ‘script:spotify’

    any help?

Leave a Reply

Your email address will not be published. Required fields are marked *