I just found this page and grabbed the script for my GeekTool setup. I've never messed with Ruby before, so I thought I'd try a few tweaks. JSON support is now apparently built into Ruby, and even though the output of tmutil status
is a plist, MacOS has a utility that can convert plist output to JSON. This also shortens the code a little, and removes the need for matches and regexes.
#!/usr/bin/ruby require 'json' plist = JSON.parse(%x{tmutil status | sed '1d' | plutil -convert json - -o -}) 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["Running"] = 1 unless plist["Percent"].nil? print ALPHABET[((plist["percent"].to_f * 100) / 2).to_i] else print "" end end