Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
#
# File: msr.py
# Version: 1.1
# Author: Damien Bobillot (damien.bobillot.2002+msr@m4x.org)
# Licence: GNU GPL version 3
# Compatibility: tested with python 2.7 on Mac OS X, should work with any python installations.
#
# Driver for the magnetic strip card reader/writer MSR605, and other versions
#
mybattery = widget({ type="textbox"})
...
mywibox[s].widgets = {
...
mybattery,
...
}
mytimer = timer({ timeout = 30 })
-- i am sorry...
mytimer:add_signal("timeout", function () mybattery.text = io.popen("acpi | sed -e 's/Battery [0-9]: //' -e's/until charged//' -e 's/remaining//' -e's/ //g' -e 's/,/ /g'"):read() end)