You are not logged in.

#1 2011-03-04 03:36:50

arinlares
Member
From: Anaheim, CA
Registered: 2010-02-01
Posts: 165
Website

Conky battery_short, and color change for battery state

I'm trying to get a conky setup I'm using for WMFS to change my battery status's color when I'm not running on AC power.

I'm trying to use conky to display basic sytem information about my laptop (CPU, RAM, Swap use, and battery status), and only know so far (after five hours of steady searching/tinkering) that I don't know what I'm doing.

I know I need to show a different string for each state (for instance "\\#4f8f4f\${battery_short} when I have the battery plugged in, and "\\#8f4f4f\${battery_short}" when I'm on battery power), but don't know how to tell conky what to do when it's running on battery, or running on AC power.

I'm trying to get the battery_short variable to show green when I have my laptop plugged into a power source, and red when it's unplugged, and running on battery.  What I have below is what I thought should work, but doesn't, and I'm not sure what it should look like in order to do this.  What I have below is my config, as it looks, and I would like to know where I'm wrong.

out_to_console yes
out_to_x no
background no
update_interval 1
total_run_times 0
use_spacer none
TEXT
BAT: ${if_match "$battery_short"!="AC"}\\#4f8f4f\${battery_short}${if_match "$battery_short"="BAT"}\\#8f4f4f\${battery_short}$endif$endif

Offline

#2 2011-03-04 23:19:53

rockin turtle
Member
From: Montana, USA
Registered: 2009-10-22
Posts: 227

Re: Conky battery_short, and color change for battery state

I don't have a laptop, so I'm not sure if this is correct, but it might work for you.

color0 4f8f4f
color1 8f4f4f
...
TEXT
BAT: $eval${if_match "$battery_short" != "D"}${color0}AC$endif${if_match "$battery_short" == "D"}${color1}BAT$endif${color}

Offline

Board footer

Powered by FluxBB