diff options
author | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-11-10 15:53:04 +0100 |
---|---|---|
committer | Adrian C. (anrxc) <anrxc@sysphere.org> | 2009-11-10 15:53:04 +0100 |
commit | 8e21d264d2bf1b420986eab364be155f85a4e0d0 (patch) | |
tree | 3e7f847ce15643723e3c8e31769a40b46eebe7ff | |
parent | e66e5075a0b42c902c9bbc628ab3c8006a261144 (diff) | |
download | vicious-legacy-8e21d264d2bf1b420986eab364be155f85a4e0d0.tar.xz |
batat: widget type removed, now available in the contrib branch
This was one of the first widgets on top of Wicked, now that we have
both procfs and sysfs covered there is no need to keep it in master.
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | batat.lua | 51 | ||||
-rw-r--r-- | init.lua | 1 |
3 files changed, 0 insertions, 59 deletions
@@ -171,13 +171,6 @@ vicious.widgets.bat level in percent and 3rd as remaining (charging or discharging) time -vicious.widgets.batat - - provides state, charge, and remaining time for all batteries using - acpitool - - returns 1st value as state of the first battery, 2nd as charge - level in percent, 3rd as remaining (charging or discharging) time, - 4th as state of the second battery etc. - vicious.widgets.batsys - provides state, charge, and remaining time for a requested battery using sysfs diff --git a/batat.lua b/batat.lua deleted file mode 100644 index 903b7d9..0000000 --- a/batat.lua +++ /dev/null @@ -1,51 +0,0 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2009, Adrian C. <anrxc@sysphere.org> ---------------------------------------------------- - --- {{{ Grab environment -local tonumber = tonumber -local io = { popen = io.popen } -local setmetatable = setmetatable -local table = { insert = table.insert } -local string = { match = string.match } --- }}} - - --- Batat: provides state, charge, and remaining time for all batteries using acpitool -module("vicious.batat") - - --- {{{ Battery widget type -local function worker(format) - local battery_info = {} - local battery_state = { - ["full"] = "↯", - ["unknown"] = "⌁", - ["charged"] = "↯", - ["charging"] = "+", - ["discharging"] = "-" - } - - -- Get data from acpitool - local f = io.popen("acpitool -b") - - for line in f:lines() do - -- Check if the battery is present - if string.match(line, "^[%s]+Battery.*") then - -- Store state and charge information - table.insert(battery_info, (battery_state[string.match(line, "([%a]*),") or "unknown"])) - table.insert(battery_info, (tonumber(string.match(line, "([%d]?[%d]?[%d])%.")) or 0)) - -- Store remaining time information - table.insert(battery_info, (string.match(line, "%%,%s(.*)") or "N/A")) - else - return {battery_state["unknown"], 0, "N/A"} - end - end - f:close() - - return battery_info -end --- }}} - -setmetatable(_M, { __call = function(_, ...) return worker(...) end }) @@ -28,7 +28,6 @@ require("vicious.thermal") require("vicious.load") require("vicious.uptime") require("vicious.bat") -require("vicious.batat") require("vicious.batsys") require("vicious.mem") require("vicious.fs") |