sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 58c89a0431c1391603136480694dee2c260e22fc
parent d12aab94e74adc4973c004ec767b27ea43879674
Author: Wojciech Gac <wgac@wp.pl>
Date:   Sat,  7 May 2011 13:50:08 +0200

This is a small battery indicator for FreeBSD. Enjoy!
Diffstat:
Awmii.suckless.org/code_snippets/python/freebsd_battery_indicator.md | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/wmii.suckless.org/code_snippets/python/freebsd_battery_indicator.md b/wmii.suckless.org/code_snippets/python/freebsd_battery_indicator.md @@ -0,0 +1,19 @@ +FreeBSD Battery Indicator +========================= + +This is a battery indicator written specifically for FreeBSD. FreeBSD has a simple command 'acpiconf -i <battery_name>', which neatly returns all relevant information. The monitor below simply parses the output and returns a compact selection of crucial data. + + + + ### + import commands + bat = 'BAT0' + ### + + @defmonitor + def bsdbattery(self): + a = commands.getoutput('acpiconf -i' + bat).splitlines() + b = dict([[i for i in j.split('\t') if i is not ''] for j in a]) + return wmii.cache['normcolors'], 'Status: ' + b['State:'] +\ + 'Capacity: ' + b['Remaining capacity:'] + ' ' +\ + 'Time remaining: ' + b['Remaining time:']+ \ No newline at end of file