From 57d847301f596dd7dc46abef1ff1d92e71e12de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 25 Jan 2017 19:38:33 +0100 Subject: [PATCH] remove batacpi: already provied by bat_freebsd --- contrib/README | 3 --- contrib/batacpi.lua | 52 --------------------------------------------- 2 files changed, 55 deletions(-) delete mode 100644 contrib/batacpi.lua diff --git a/contrib/README b/contrib/README index a6c0416..88e15e1 100644 --- a/contrib/README +++ b/contrib/README @@ -44,9 +44,6 @@ vicious.contrib.ati {dpm_perf_level}, {profile}, {engine_clock mhz}, {engine_clock khz}, {memory_clock mhz}, {memory_clock khz}, {voltage v}, {voltage mv} -vicious.contrib.batacpi - - - vicious.contrib.batpmu - diff --git a/contrib/batacpi.lua b/contrib/batacpi.lua deleted file mode 100644 index fc7d54b..0000000 --- a/contrib/batacpi.lua +++ /dev/null @@ -1,52 +0,0 @@ ---------------------------------------------------- --- Licensed under the GNU General Public License v2 --- * (c) 2010, Adrian C. ---------------------------------------------------- - --- {{{ Grab environment -local tonumber = tonumber -local io = { popen = io.popen } -local setmetatable = setmetatable -local table = { insert = table.insert } -local string = { match = string.match } --- }}} - - --- Batacpi: provides state, charge, and remaining time for all batteries using acpitool --- vicious.contrib.batacpi -local batacpi = {} - - --- {{{ 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 --- }}} - -return setmetatable(batacpi, { __call = function(_, ...) return worker(...) end })