Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Mac Community > Picture Gallery > UI Customization

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 16, 2012, 04:21 PM   #1
kingpixels
macrumors newbie
 
Join Date: Dec 2012
Help - Geektool Battery Meter

I found a script for RAM, that shows a certain amount of bars depending on the used memory:

Code:
mUSED=`top -l 1 | grep PhysMem: | awk '{print $8}'`
mFREE=`top -l 1 | grep PhysMem: | awk '{print $10}'`
G="G"
M="M"
if [ `echo ${mUSED: -1:1}` = `echo ${mFREE: -1:1}` ]
then
	USED=`top -l 1 | grep PhysMem: | awk '{print "X"int($8/($8+$10)*50)"X"}'`
else
	if [ `echo ${mUSED: -1:1}` = $M -a `echo ${mFREE: -1:1}` = $G ]
		then
			USED=`top -l 1 | grep PhysMem: | awk '{print "X"int($8/($8+$10*1000)*50)"X"}'`
		else
			USED=`top -l 1 | grep PhysMem: | awk '{print "X"int(($8*1000)/($8*1000+$10)*50)"X"}'`
	fi
fi
echo $USED | sed "s/X0X/a/;s/X1X/b/;s/X2X/c/;s/X3X/d/;s/X4X/e/;s/X5X/f/;s/X6X/g/;s/X7X/h/;s/X8X/i/;s/X9X/j/;s/X10X/k/;s/X11X/l/;s/X12X/m/;s/X13X/n/;s/X14X/o/;s/X15X/p/;s/X16X/q/;s/X17X/r/;s/X18X/s/;s/X19X/t/;s/X20X/u/;s/X21X/v/;s/X22X/w/;s/X23X/x/;s/X24X/y/;s/X25X/z/;s/X26X/A/;s/X27X/B/;s/X28X/C/;s/X29X/D/;s/X30X/E/;s/X31X/F/;s/X32X/G/;s/X33X/H/;s/X34X/I/;s/X35X/J/;s/X36X/K/;s/X37X/L/;s/X38X/M/;s/X39X/N/;s/X40X/O/;s/X41X/P/;s/X42X/Q/;s/X43X/R/;s/X44X/S/;s/X45X/T/;s/X46X/U/;s/X47X/V/;s/X48X/W/;s/X49X/X/;s/X50X/Y/"
I'm fairly incompetent when it comes to coding Geektool scripts, so I was hoping someone could help me turn this into a battery metre.

The way that it works is that the site provided a font to apply on it, that works like this:

'a' shows as zero bars.
'b' shows as one bar.
'c' shows as two bars.

..and so on, until 'z', which equals 25 bars.
The alphabet restarts then, with capitals.

'A' shows as 26 bars.
'B' shows as 27 bars.
'C' shows as 28 bars.
...
'Y' shows as 50 bars.

The idea is that the RAM metre is out of fifty, so if all ram is used, it would send a 'Y', which would show as 50 bars.

I was hoping someone could help me do the same with battery, so that 100% and 99% would be 'Y', 98% and 97% would be 'X' etc.

Thanks for any help you can provide.
kingpixels is offline   0 Reply With Quote

Reply
MacRumors Forums > Mac Community > Picture Gallery > UI Customization

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:02 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC