Posts: 19
Tanga
Joined: 21 Jan 2012
#1
Hi,

Conky reads my battery amount okay, using the command:
${execi 10 (acpi -b | awk)}${voffset 1}${battery_bar 6, 162 BAT1}
(so my battery isn't the default - BAT0) and the graph it displays seems accurate. I only have about 20 minutes or so of battery, and sometimes I forget I'm not plugged in. I would love a warning beep when the battery level gets to 10% and for the computer to shutdown at 5%. I am a complete noob, so if there is scripting I'll probably need obvious stuff spelt out to me.

Thanks again for all your help folks,

Tamsyn
Posts: 4,164
rokytnji
Joined: 20 Feb 2009
#2
Try


========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"http://lists.debian.org/debian-user/2009/03/msg02524.html"
linktext was:"http://lists.debian.org/debian-user/200 ... 02524.html"
====================================

Code: Select all

Biker:~$ apt-cache policy beep
beep:
  Installed: (none)
  Candidate: 1.3-1
  Version table:
     1.3-1 0
        500 http://ftp.us.debian.org/debian/ testing/main i386 Packages
Posts: 4,164
rokytnji
Joined: 20 Feb 2009
#3
Simple extra way to monitor battery in Icewm Taskbar is in

Control Center>Edit Icewm Settings> preferences

on line 65 change TaskBarShowAPMStatus=0 to

Code: Select all

TaskBarShowAPMStatus=1
then logout and then log back into icewm. AS far as setting up Beep in APM. I have no clue.

You might want to look through your bios settings for setting up advanced power management =(apm) so the beep comes from bios setting.
Posts: 1,062
Dave
Joined: 20 Jan 2010
#4
you can make conky read the battery percent value, then compare it to a set value (10% in your case). Then when the battery percentage reading from conky is equal to or less than your set value it will execute the warning. I used notify-send for this. The only problem with this is that it may take a few minutes for the warning to stop showing up. This is because it takes a while for the battery to get charged enough.

You can find the code I used here
post18388.html#p18388

EDIT
after you extract the tarball you will need to show hidden files for the .conkyrc
Posts: 19
Tanga
Joined: 21 Jan 2012
#5
Thanks guys. I found the BIOS setting, down in power management. It doesn't start until things are pretty critical, but if I'm on the computer then I have plenty of time. I'll need to work out how to suspend or shutdown after 30 seconds or so of that though - still trawling through websites, but the layout of IceWM and/or Antix are different enough to what I've found for me and my very basic linux knowledge to be unable to adapt. Roky, that script looks handy, but I don't understand enough to get it working. A bit more detail as it applies to IceWM? I don't have battery_monitor in any of my acpi folders. __{{emoticon}}__

Dave, I tried your conky addition. As far as I can work out this is the relevant bit:

Code: Select all

${if_existing /sys/class/power_supply/AC/online 1}
${voffset -15}${color 4afb04}${font Webdings:size=15}~${font} ${color cccccc}Charging: ${color 4afb04}${battery_bar 10,107 BAT1}  ${color 4afb04}${battery_percent BAT1}%${voffset -15}
${else}${if_match ${battery_percent BAT1} > 50}
${voffset -15}${color 4afb04}${font Webdings:size=15}~${font} ${color cccccc}Battery: ${color 4afb04}${battery_bar 10,107 BAT1}  ${color 4afb04}${battery_percent BAT1}%${voffset -15}
${else}${if_match ${battery_percent BAT1} > 15}
${voffset -15}${color fc8208}${font Webdings:size=15}~${font} ${color cccccc}Battery: ${color fc8208}${battery_bar 10,107 BAT1}  ${color fc8208}${battery_percent BAT1}%${voffset -15}
${else}${color fd0000}${font Webdings:size=15}~${font} ${color}Battery: ${color fd0000}${battery_bar 10,107 BAT1}  ${color fd0000}${battery_percent BAT1}%${endif}${endif}${endif}
${color 4afb04}${font webdings:size=15}q${font}${color cccccc}Sound ${if_mixer_mute}${font size:12}${color red}Muted ! ${mixerbar Master 10,91}${font}${else}${color cccccc} Level:  ${mixerbar Master 10,110}${endif}
${if_existing /sys/class/power_supply/AC/online 0}
${if_match ${battery_percent BAT1} <= 15}${execi 20 notify-send -t 10000 -i /usr/share/icons/gTangish-2.0a1/48x48/status/battery-caution.png"Battery Low""Battery Level is 15%                               Suggesting to save your work, or plug in the computer."}${endif}${endif}
${if_match ${acpitemp} >= 70}${execi 20 notify-send -t 10000 -i /usr/share/icons/gTangish-2.0a1/48x48/status/dialog-warning.png"Tempurature High""Shut Down will occur if Tempurature rises. Suggesting you save your work"}${endif}
${if_existing /sys/class/power_supply/AC/online 0}
${if_match ${battery_percent BAT1} <= 5}${execi 40 lowbattery}${endif}${endif}
${if_match ${acpitemp} >= 75}${execi 40 hightemp}${endif}
I also copied across the high temp, and low battery scripts. I'm not sure if that is what I should be doing? I wouldn't mind running espeak"low battery" or even"I need more power Cap'n" __{{emoticon}}__ - though how to give text to speech a Scottish accent I don't know. I'm sure there is a wav file somewhere I can play. __{{emoticon}}__

But first to get the code to work. There's something I'm doing wrong though, as it breaks conky.
Posts: 1,062
Dave
Joined: 20 Jan 2010
#6
Yep that is the right part, remove the lines related to sound / tempurature, to make your troubleshooting alot easier. It is probably the referances to /sys/powersupply are not 100% there, the file path will need to be tweaked to match your system layout. Just run thunar in /sys and do a little exploration for the online file. Also on some systems the 1 may mean online or the 0 may mean online. once it is working its easy enough to figure out, just plug it in and see if it registers as online.