Quote:
Originally Posted by isarl
|
After some tinkering with telnet, I figured out how to make an ugly but functional battery status option with NickelMenu.
Code:
menu_item :main :Battery :cmd_output :500 :cat /sys/class/power_supply/battery/capacity /sys/class/power_supply/battery/voltage_now /sys/class/power_supply/battery/voltage_min /sys/class/power_supply/battery/voltage_max /sys/class/power_supply/battery/charge_now /sys/class/power_supply/battery/charge_full /sys/class/power_supply/battery/charge_full_design
This will generate a pop-up window containing:
- The current charge as a percentage
- The current voltage
- The minimum voltage
- The maximum voltage
- The current capacity (mAh)
- The maximum capacity
- The maximum design capacity
The pop-up window will look like this (but without the key):
Code:
39
3707800 (3.71 V)
3520000 (3.52 V)
4200000 (4.20 V)
590000 (590 mAh)
1429000 (1429 mAh)
1430000 (1430 mAh)
You may be able to guess that this output is from my Libra 2 by the battery capacity.
You can track the decline in the voltage as the battery discharges, and you can track the health of your battery by comparing the maximum capacity against the design capacity. You can also double check the calculated percentage by dividing (current capacity / maximum capacity). In this example, the capacity indicates 41%, but the battery meter claims 39%.
Of course, this assumes that sysfs actually produces reliable numbers, but at least it's more information than the default battery meter gives us.
If any Linux gurus out there can tell me how I could intercept the output of cat and format it nicely instead of displaying the raw numbers, I'd be interested to try that.