| Juanito  
 
  
 
 
 Group: Members
 Posts: 1601
 Joined: Sep. 2005
 | 
|  | Posted: April 12 2007,08:30 |  |  I tried out your script - in the original .torsmorc file there is already a line:
 | Code Sample |  | ${color #ddd}Battery:  $color ${battery} | 
 Do you mean to modify it to read as follows?
 | Code Sample |  | ${color #ddd}Battery:  $color ${battery} ${execi 60 ~/.battery_sh} | 
 The battery has not run down to 20% yet so I could not verify this works...
 
 Thanks for providing the motivation to look at the .torsmorc file, I added the following line immediately after the battery line to show the cpu temperature:
 | Code Sample |  | ${color #ddd}Temp:  $color ${acpitemp}degC | 
 You could add to your script to call "exitcheck.sh shutdown" when the battery charge drops to 5% - This being said, on my machine the battery will last for at least 30 minutes when it shows less than 5 minutes life remaining
 | Code Sample |  | cat /proc/acpi/battery/BAT0/info 
 present:                 yes
 design capacity:         42000 mWh
 last full capacity:      20740 mWh
 battery technology:      rechargeable
 design voltage:          11100 mV
 design capacity warning: 4200 mWh
 design capacity low:     1272 mWh
 capacity granularity 1:  420 mWh
 capacity granularity 2:  420 mWh
 model number:            DELL 0006T0
 serial number:           404
 battery type:            LION
 OEM info:                Sanyo
 | 
 Is there any way to change "last full capacity"?
 
 From Google, there are a number of good (and complex - for me at least) scripts to catch all manner of acpi events using acpid and act on them. For example, from the above, I believe your script could be called on "design capacity warning: 4200 mWh" being met and shutdown called on "design capacity low: 1272 mWh" being met.
 
 In a similar manner, cpufreqd (in 2.6.x) is using acpi events to make decisions like:
 
 If the battery capacity is > 75% then run then run the cpu at full speed no matter what
 or
 If 25% < battery capacity < 75% then increase the cpu speed on only on demand
 or
 If battery capacity < 25% then run the cpu at minimum speed no matter what.
 
 I believe a whole DSL library of acpi/acpid actions could be built on battery, fan, lid, powerbutton, temp, etc events - food for scripting thought...
 |