Had forgotten! A sleep for 10/30/60 seconds as suited too can be given, as an improvisation.
On Sun, Apr 19, 2009 at 11:20 PM, Raghavan, Vinay <[email protected]>wrote: > Hi, > > Extending battery life (which in turn helps us squeeze juice out of it for > longer running times) is a pretty usual requirement. Thnx for the idea > though! =) > > checked the below by parts, worked in lenny. Please check in ubuntu. Script > might need some tuneup/corrections. Please feel free to addup/correct as > needed. Running this as part of login should do. (put in profile.d / > somewhere. using a flagfile to see if an instance of this script is already > running can help in ensuring that only one instance runs) > > > #!/bin/bash > > ######################################################################################## > export flagval=0 > > while [ $flagval = 0 ] > do > export st=`grep -w "charging state" /proc/acpi/battery/BAT0/state |awk > '{print $3}'` > > # if not on AC power, it will be 'discharging'; 'charging' upon being > charged > # and 'charged' upon completely charged. > # however, battery has to have been calibrated before once, else this > might not be a proper signal. > if [ "$st" = "charged" ] > then > echo -en "Calling screenlocker , fire a notify daemon script with > custom message" > # notify-send will be part of libnotify-bin package, usually not > installed by default in debian/ubuntu. > # Please install the same through apt if its notin the machine. > notify-send -t 65535 "Battery is fully charged. PTP, the power plug > !!! " > gnome-screensaver-command -l > flagval=1 > else > curtim=`date `; echo "[${curtim}] : still charging " >> > /tmp/batstat.log > fi > done > > curtim=`date `; echo "=== DEBUG: batstat script ends. [${curtim}] ===" >> > /tmp/batstat.log > > ######################################################################################## > # the above listing keeps running till battery is fully charged, upon which > a notification is thrown and screen > # locked, prompting him for password, and upon login keeps the notification > active. > # _raghava_ , on April 19, 2009. > > ######################################################################################## > > Hope this helps! As said before, please feel free to refine/add up as > suitable. =) > > > > On Sun, Apr 19, 2009 at 9:59 PM, Sindhu S <[email protected]>wrote: > >> >> Hi all! >> >> I own a Asus EEE 1000H (160GB HDD) and am very particular about the >> battery discharge, I unplug from AC power as soon as it charged 100% >> as from my previous experience with my Compaq laptop I learnt that >> keeping any netbook/laptop plugged in on AC power all the time causes >> battery life to deplete rapidly. >> >> This summer I have quite some time on hand and i figured maybe I could >> device a way in which I can prevent this battery drain. >> >> So I was thinking as soon as my "program" reads that ACPI is reporting >> battery status as 100% charged, I lock the screen, forcing the user >> (me) to unplug the AC cord and unless the power cord is unplugged the >> screen won't be unlocked. >> >> Low battery status is notified properly for me by "power >> management" (am on Gnome on Jaunty Beta) but full status of the >> battery is sometimes notified or sometimes I miss it as a result of >> being away from the netbook. >> >> I don't know how to get started, am confused as I don't know how the >> internals of ACPI work...like would it be right to assume that acpi >> sends out a notification when battery has been charged 100%? so that I >> can make use of this notification and lock the screen ? >> >> Can I write my "program" as a shell script? >> >> I don't have any experience programming under Gnome, so can you guys >> please help out with suggestions/ideas? >> >> Thank you! :) >> >> >> > > > -- > Regards , > > Raghavan K S > 99860 31265 > Mysore. > http://raghavan.vinay.googlepages.com > -- Regards , Raghavan K S 99860 31265 Mysore. http://raghavan.vinay.googlepages.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MyLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/mylug?hl=en -~----------~----~----~----~------~----~------~--~---
