[wiki] [sites] wiki updated

From: <hg_AT_suckless.org>
Date: Sat, 7 May 2011 13:52:21 +0200 (CEST)

changeset: 729:68ba938c70b7
tag: tip
user: Wojciech Gac <wgac_AT_wp.pl>
date: Sat May 07 13:50:08 2011 +0200
files: wmii.suckless.org/code_snippets/python/freebsd_battery_indicator.md
description:
This is a small battery indicator for FreeBSD. Enjoy!


diff -r 3aee7121f3cc -r 68ba938c70b7 wmii.suckless.org/code_snippets/python/freebsd_battery_indicator.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/wmii.suckless.org/code_snippets/python/freebsd_battery_indicator.md Sat May 07 13:50:08 2011 +0200
_AT_@ -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'
+ ###
+
+ _AT_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
Received on Sat May 07 2011 - 13:52:21 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:31:44 CEST