Here’s a quick hack for GeekTool users who use Time Machine and don’t have enough stuff on their Desktop. That’s everybody, right?

I wanted a better indicator of whether Time Machine was running and how much it had left to back up. I built a little Geeklet that creates a circular progress indicator on my Desktop. You can do the same using the script below along with the ARC font (it’s hard to find these days for some reason, so I’m hosting a copy here).

The ARC font is basically a partial circle that gets more complete as you move through the alphabet, lowercase first, then uppercase. By the time you get to “Z,” it’s a full circle. Because it’s a font, it works at any size and with any foreground color. For this Geeklet, I’m liking just having a little 50-pixel translucent white circle on a dark area of my desktop.

Installation

  1. Save the script below to a file (e.g. “~/scripts/tmstatus.rb”)
  2. Make it executable (chmod a+x ~/scripts/tmstatus.rb)
  3. Add a shell Geeklet with the path to the script as the command
  4. Install the ARC font (unzip and double click the font file)
  5. Set the Geeklet’s font to ARCFont
  6. Change the size of the circle by adjusting the font size in the font panel
  7. Pick a foreground color/opacity by clicking the green color well in the font palette

You should be good to go.

Update: I’ve fixed the code to recognize the 100% complete state.

#!/usr/bin/ruby

plist = %x{tmutil status}
ALPHABET = %w{ a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y }
if plist.match(/Running = 1;/)
    raw_percent = plist.match(/\s+Percent = "?(\d(?:\.\d+)?)"?;/)
    unless raw_percent[1].nil?
        percent = ((raw_percent[1].to_f * 100) / 2).to_i
        print ALPHABET[percent]
    end
end

If you want a full-circle background to make it more of a progress meter, create a second shell Geeklet and set it to the ARC font at the same size as the first one. Turn “Override text” on and type “Y” in the field. Set the color to a darker, more transparent version of the main Geeklet’s foreground color. Use the X/Y position numbers to position it exactly over the main Geeklet and then right click and “send to back”.

Explanation

The script uses tmutil status (man page) and parses out the raw percentage complete, converting it to an integer between 1 and 50, which it then maps to the alphabetical character that the font uses. If there’s no Time Machine backup running, it disappears. When you’re testing, be sure to “Back up now” from the Time Machine menu bar item so you have something to work with.

The ARC font is a brilliant and flexible tool for GeekTool (and NerdTool) users. The basic concept of this script can be applied to anything that offers a status report within a known range. I use the same style for CPU usage meters. Let me know what you come up with!

Also, don’t forget to grab Marked 2 for 20% off before the 26th. Use the coupon code MARKDOWNFORTHEHOLIDAYS13.