to get {dis}charge rate using the getprocinfo function from before
BATRATE=`getprocinfo /proc/acpi/battery/BAT1/state 3 rate`
and approximate time remaining in minutes
BATTIME=$(($BATREMAIN*60/$BATRATE))
Barry's Partview script has some code for generating images on the fly using ppmrough and ppmtogif
I was wondering if you could use an embedded xpm, but set the 6 digit data for the colors to be variables
(crude "battery" example)
Code: Select all
/* XPM */
static char *test_xpm[] = {
"24 24 21 1",
"0 c None",
"1 c #FF0000",
"2 c #FF0000",
"3 c #FF0000",
"4 c #FF0000",
"5 c #FF0000",
"6 c #FF0000",
"7 c #FF0000",
"8 c #FF0000",
"9 c #FF0000",
"a c #FF0000",
"b c #FF0000",
"c c #FF0000",
"d c #FF0000",
"e c #FF0000",
"f c #FF0000",
"g c #FF0000",
"h c #FF0000",
"i c #FF0000",
"j c #FF0000",
"k c #FF0000",
"000000000000000000000000",
"000000000000000000000000",
"000000111111111111000000",
"000000222222222222000000",
"000000333333333333000000",
"000000444444444444000000",
"000000555555555555000000",
"000000666666666666000000",
"000000777777777777000000",
"000000888888888888000000",
"000000999999999999000000",
"000000aaaaaaaaaaaa000000",
"000000bbbbbbbbbbbb000000",
"000000cccccccccccc000000",
"000000dddddddddddd000000",
"000000eeeeeeeeeeee000000",
"000000ffffffffffff000000",
"000000gggggggggggg000000",
"000000hhhhhhhhhhhh000000",
"000000iiiiiiiiiiii000000",
"000000jjjjjjjjjjjj000000",
"000000kkkkkkkkkkkk000000",
"000000000000000000000000",
"000000000000000000000000"
};