Current track shown on desktop

Before I wrote the script I use for generating my Random Ten lists, I wrote this little script, called playing, with the thought I could use it to insert the song I’m listening to into my posts. Never went anywhere with that, but today I installed GeekTool—a Preference Pane for displaying file or program output on your desktop—and I decided to dust off playlist and use it to show the current iTunes track in the lower left corner of my screen.

The script is this:

#!/bin/bash

cat <<ENDSCRIPT | osascript
tell application "iTunes"
  if player state is playing then
    set who to artist of current track as string
    set what to name of current track as string
    set onwhat to album of current track as string
    set notify to "\"" & what & "\" by " & who & "\nfrom " & onwhat
  else
    set notify to "Nothing"
  end if
  notify
end tell
ENDSCRIPT

By setting GeekTool to run it in the lower right corner of my screen, with right justified, white shadowed text, I get this

This is usually at least partly visible, tucked away under my vertical tool bar that runs along the right side of the monitor. If not, a quick F11, which is my Exposé key for revealing the Desktop, moves everything out of the way for me. The program is rerun every 10 seconds, so it updates relatively quickly after a change of song.

Update: This script has some problems, which are described and fixed in this later post.

Tags: