Conky and battery status

New to Debian (Or Linux in general)? Ask your questions here!

Conky and battery status

Postby vikozo » 2017-02-22 13:10

Hello
i have on my Laptop Conky which Shows also the Batterie Status

Battery: ${battery_percent BAT0}% ${alignr}${battery_bar 8,70 BAT0}
and yes if works fine sofar.

But is there a possibiliti to have a Orange battery_bar if the power go out / and a green battery_bar if the battery is loading.

have a nice day
vinc
vikozo
 
Posts: 20
Joined: 2016-03-06 10:55
Location: suisse

Re: Conky and battery status

Postby jjgomera » 2017-02-22 14:08

Something like:

Battery: ${execpi 5 cat /sys/class/power_supply/BAT0/uevent | grep POWER_SUPPLY_CAPACITY= | cut -d'=' -f2 | xargs ~/Configuration/colorizebattery.sh}% ${alignr}${battery_bar 8,70 BAT0}${color}

maybe you must change the execpi command to fit to your system. It need the colorizebattery.sh script:

Code: Select all
#!/bin/bash
# colorizebattery.sh

FULL=80
FINE=40
WARM=10

if [[ $1 > $FULL ]]
   then echo "\${color green}"$1   
elif [[ $1 > $FINE ]]
   then echo "\${color yellow}"$1 
elif [[ $1 > $WARM ]]
   then echo "\${color orange}"$1
else echo "\${color red}"$1     
fi

exit 0


Don't forget give execution flag to script:
Code: Select all
chmod +x ~/Configuration/colorizebattery.sh


You can customize the script to show more color scale.
jjgomera
 
Posts: 9
Joined: 2013-02-05 18:05

Re: Conky and battery status

Postby alan stone » 2017-02-22 14:19

I haven't tested it, however you might have a look here, here and here ('using lua scripts in conky' section).
Debian GNU/Linux 8.8 (jessie)
wm: openbox

If you initiate coercion, force, violence to enforce your idea or theory, or if every single time it is applied to the real world it fails completely, your idea or theory sucks and is worthless.
User avatar
alan stone
 
Posts: 151
Joined: 2011-10-22 14:08
Location: In my body.

Re: Conky and battery status

Postby margaretH » 2017-03-06 01:28

There is also a online documentation.
i did not look into it , only saw its listing.
margaretH
 
Posts: 14
Joined: 2017-01-23 20:22


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable