Topic: https://brettterpstra.com/2013/12/24/a-geektool-time-machine-progress-indicator/
hide preview

What's next? verify your email address for reply notifications!

unverified 5y, 285d ago

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
hide preview

What's next? verify your email address for reply notifications!

Behinder 11y, 85d ago

Brilliant work :)

hide preview

What's next? verify your email address for reply notifications!