Use Geektool to display conditional images?
Hey all,
I've recently discovered Geektool, but also noticed that some of the scripting is still far out of my league as I only recently made the switch to a Mac.
Therefore, I would like to ask you amazing coders if you would be able to pull anything like this off:
I have found this really neat Futurama wallpaper at kremalicious.com (
http://www.kremalicious.com/2009/02/out-of-whale-oil/). For those not Futurama-fans (shame on you

), the whale-oil is more or less the gasoline of the future, and therefore I figured that it would be nice to use the whale in the middle of the desktop to display my battery charge.
However, my issue: Can Geektools (v3) display conditional images?
Here's my basic idea:
I will use the background with the completely 'white' whale. This corresponds to a full battery charge.
I cut up the other image, with the nearly empty 'blue' whale into 9 parts. (The grid in the whale contains 10 blocks).
Then what I would need is a geeklet script that displays the first blue block on top of the background image as soon as my battery ticks below 90%, the second after 80%, etcetera.
Is there a script that could pull this off? I've already browsed this entire thread, but I havent seen anything like this yet. I did find the following piece of code by raltenbach on page 57, which already correctly returns the battery charge, if that is of any help:
Code:
#!/bin/bash
asbreg=`ioreg -rc "AppleSmartBattery"`
maxcap=`echo "${asbreg}" | awk '/MaxCapacity/{print $3}'`;
curcap=`echo "${asbreg}" | awk '/CurrentCapacity/{print $3}'`;
prcnt=`echo "scale=2; 100*$curcap/$maxcap" | bc`;
printf "%1.0f%%" ${prcnt};
#EOF
Many many thanks in advance guys!