finderscreensnapz0021

Vancouver Cityscape / GeekTools Desktop

I’ve constantly been enamoured with what keeners have done with GeekTools as seen on Lifehacker, and the recent Mario desktop got me going. The major project was to reduce disk and memory usage summaries to percentages. The hard drive one was easy enough, but the memory use percentage was headtumper. Nobody, as I could find on the Google, had done exactly what I wanted. I did the math fine (didn’t take long), but adding the percent at the end was the bitch!

GeekTools apparently operates slightly differently in shell, so I had to go step by step and think around this one. I originally had the shell line as "top -l 1 | grep PhysMem | tr -d 'M' | awk '{print $8/($8+$10)*100}' | awk '{printf "%2.0f\n",$0}' | sed '$a%' | tr -d '\n'” which didn’t quite shake it. Sometimes the simplest way (which pulls it off) requires some sleep and time away.

The desktop I found using CoolIris — and as much as I meant to save the address I didn’t. I don’t think the image is licenced for distribution, so three cheers for fair use! The fonts are Betty Noir and HaraldSquare.

Vancouver Weather (shell):

curl --silent "http://xml.weather.yahoo.com/forecastrss?p=CAXX0518&u=c" | grep -E '(Current Conditions:|C<BR)' | sed -e 's/<br \/>//' -e 's/<b>//' -e 's/<\/b>//' -e 's/<BR \/>//' -e 's/<description>//' -e 's/<\/description>//' | tr -d "\n" | sed -e 's/:/ : /' -e 's/Current Conditions/Vancouver Weather/'

Day Name (shell):

date +%A

Date (shell):

date +%d

Abbr. Month (shell):

date +%b

Time (shell):

date "+%l:%M %p"

Text (shell):

echo HdMr

Hard Drive Usage as Percent (shell):

df / | awk '{print $5}' | sed -e 's/Capacity//' | tr -d "\n"

Memory Usage as Percent (shell):

top -l 1 | awk '/PhysMem/ {printf "%2.0fper",$8/($8+$10)*100}' | sed -e 's/per/\%/'