Cleanup widgets that use pathtotable helper

This commit is contained in:
Adrian C. (anrxc) 2009-11-11 14:32:37 +01:00
parent 76942d17a4
commit 1d0cfd3aed
6 changed files with 6 additions and 26 deletions

View File

@ -21,11 +21,7 @@ module("vicious.bat")
-- {{{ Battery widget type
local function worker(format, batid)
local battery = setmetatable(
{ _path = "/sys/class/power_supply/" .. batid },
helpers.pathtotable
)
local battery = helpers.pathtotable("/sys/class/power_supply/" .. batid)
local battery_state = {
["Full\n"] = "",
["Unknown\n"] = "",

View File

@ -17,11 +17,7 @@ module("vicious.cpufreq")
-- {{{ CPU frequency widget type
local function worker(format, cpuid)
local cpufreq = setmetatable(
{ _path = "/sys/devices/system/cpu/"..cpuid.."/cpufreq"},
helpers.pathtotable
)
local cpufreq = helpers.pathtotable("/sys/devices/system/cpu/"..cpuid.."/cpufreq")
local governor_state = {
["ondemand\n"] = "",
["powersave\n"] = "",

View File

@ -27,10 +27,7 @@ local disk_total = {}
-- {{{ Disk I/O widget type
local function worker(format, disk)
local disk_lines = {}
local disk_stats = setmetatable(
{ _path = "/sys/block/" .. disk },
helpers.pathtotable
)
local disk_stats = helpers.pathtotable("/sys/block/" .. disk)
if disk_stats.stat then
local match = string.gmatch(disk_stats.stat, "[%s]+([%d]+)")

View File

@ -17,10 +17,7 @@ module("vicious.entropy")
-- {{{ Entropy widget type
local function worker(format)
local random = setmetatable(
{ _path = "/proc/sys/kernel/random"},
helpers.pathtotable
)
local random = helpers.pathtotable("/proc/sys/kernel/random")
-- Linux 2.6 has a default entropy pool of 4096-bits
local poolsize = tonumber(random.poolsize)

View File

@ -15,10 +15,7 @@ module("vicious.thermal")
-- {{{ Thermal widget type
local function worker(format, thermal_zone)
local thermal = setmetatable(
{ _path = "/sys/class/thermal/" .. thermal_zone },
helpers.pathtotable
)
local thermal = helpers.pathtotable("/sys/class/thermal/"..thermal_zone)
-- Get ACPI thermal zone
if thermal.temp then

View File

@ -18,10 +18,7 @@ module("vicious.uptime")
-- {{{ Uptime widget type
local function worker(format)
local proc = setmetatable(
{ _path = "/proc" },
helpers.pathtotable
)
local proc = helpers.pathtotable("/proc")
-- Get system uptime
local up_t = math.floor(string.match(proc.uptime, "[%d]+"))