aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2009-11-11 14:32:37 +0100
committerAdrian C. (anrxc) <anrxc@sysphere.org>2009-11-11 14:32:37 +0100
commit1d0cfd3aeded65ded10b7ab3163488c3dc1d4383 (patch)
tree8de5320c33a0167a9e32bcaca386e7e6d3802f7b
parent76942d17a448a2f6a45fb4b3d4d139c416fdf376 (diff)
downloadvicious-legacy-1d0cfd3aeded65ded10b7ab3163488c3dc1d4383.tar.xz
Cleanup widgets that use pathtotable helper
-rw-r--r--bat.lua6
-rw-r--r--cpufreq.lua6
-rw-r--r--dio.lua5
-rw-r--r--entropy.lua5
-rw-r--r--thermal.lua5
-rw-r--r--uptime.lua5
6 files changed, 6 insertions, 26 deletions
diff --git a/bat.lua b/bat.lua
index 6241072..e55695f 100644
--- a/bat.lua
+++ b/bat.lua
@@ -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"] = "⌁",
diff --git a/cpufreq.lua b/cpufreq.lua
index 7718a52..1eddcb9 100644
--- a/cpufreq.lua
+++ b/cpufreq.lua
@@ -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"] = "⌁",
diff --git a/dio.lua b/dio.lua
index 41c0663..07b7266 100644
--- a/dio.lua
+++ b/dio.lua
@@ -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]+)")
diff --git a/entropy.lua b/entropy.lua
index e2f0e0c..5cea64a 100644
--- a/entropy.lua
+++ b/entropy.lua
@@ -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)
diff --git a/thermal.lua b/thermal.lua
index f8b174e..6d0f63b 100644
--- a/thermal.lua
+++ b/thermal.lua
@@ -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
diff --git a/uptime.lua b/uptime.lua
index c7082c1..540c690 100644
--- a/uptime.lua
+++ b/uptime.lua
@@ -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]+"))