Hi
I am a fairly new user to geeklets but think they are great ( I may actually get out of the house soon after finding these ).
I have put together a fairly simple geeklet to show a disk free bar to follow on from the position of the disk used geeklet which I obtained from this site.
The disk free geeklet needs a name of 'disk 1 free' in this example and uses geeklet 'disk used 1' to work out its start position.
I have preset the height of the disk used geek lets to 14.
There are probably better ways of doing this but this is my first start.
disk used geeklet:
#Variable to specify the desired full width of the bar (if the vale was 100%)
FULLW=100
#Get the disk used %
DISKUSED=`df | awk '/dev\/disk1s2/ && NF>1 {print $5}' | sed 's/\%//'`
#Calculate the scale width of the bar based on the disk used %
BARW=$(echo "$DISKUSED * $FULLW / 100" | bc)
#Update the width of the geeklet
osascript -e "tell application \"GeekTool Helper\" to set width of first item of (geeklets whose name is \"DiskUsed Bar 1\") to $BARW"
#Display the disk used % as text in the bar (delete line if not required)
echo $DISKUSED
Disk Free geeklet:
#Variable to specify the desired full width of the bar (if the value was 100%)
FULLW=100
#Get the disk used %
DISKUSED=`df | awk '/dev\/disk0s2/ && NF>1 {print $5}' | sed 's/\%//'`
#Calculate the scale width of the bar based on the disk free %
BARW=$(echo "100 - $DISKUSED * $FULLW / 100" | bc)
#Update the width of the geeklet
osascript -e "tell application \"GeekTool Helper\" to set width of first item of (geeklets whose name is \"disk 1 free\") to $BARW"
#Calculate the start offset of the bar based on the disk used %
BAROFFSET=$(echo "$DISKUSED * $FULLW / 100" | bc)
#Update the width of the geeklet
osascript -e "tell application \"GeekTool Helper\" to set x position of first item of (geeklets whose name is \"disk 1 free\") to x position of (geeklets whose name is \"disk used 1\") + $BAROFFSET"