aboutsummaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2010-03-15 17:55:25 +0100
committerAdrian C. (anrxc) <anrxc@sysphere.org>2010-03-15 17:55:25 +0100
commit0299c15dc0869a12ceec947e6e51088bb88da56d (patch)
treee1989cb5e9fe5ea1e0edaed0754265a4056690c4 /widgets
parent4fc6dffe94d01a4696bf1f7420b79b05ecf5d35c (diff)
downloadvicious-legacy-0299c15dc0869a12ceec947e6e51088bb88da56d.tar.xz
widgets: minor cleanup before a tag in cpuinf, fs, mbox...
Diffstat (limited to 'widgets')
-rw-r--r--widgets/cpuinf.lua3
-rw-r--r--widgets/fs.lua3
-rw-r--r--widgets/hddtemp.lua3
-rw-r--r--widgets/mbox.lua6
-rw-r--r--widgets/uptime.lua3
5 files changed, 7 insertions, 11 deletions
diff --git a/widgets/cpuinf.lua b/widgets/cpuinf.lua
index 8bee530..b925b27 100644
--- a/widgets/cpuinf.lua
+++ b/widgets/cpuinf.lua
@@ -18,9 +18,8 @@ module("vicious.widgets.cpuinf")
-- {{{ CPU Information widget type
local function worker(format)
local id = nil
- local cpu_info = {}
- -- Get CPU info
+ local cpu_info = {} -- Get CPU info
for line in io.lines("/proc/cpuinfo") do
for k, v in string.gmatch(line, "([%a%s]+)[%s]+:[%s]([%d]+).-$") do
if k == "processor" then
diff --git a/widgets/fs.lua b/widgets/fs.lua
index 4490c91..63d2089 100644
--- a/widgets/fs.lua
+++ b/widgets/fs.lua
@@ -25,9 +25,8 @@ local function worker(format, warg)
-- Fallback to listing local filesystems
if warg then warg = "" else warg = "-l" end
- -- Get (non-localized)data from df
+ local fs_info = {} -- Get data from df
local f = io.popen("LC_ALL=C df -kP " .. warg)
- local fs_info = {}
for line in f:lines() do -- Match: (size) (used)(avail)(use%) (mount)
local s = string.match(line, "^.-[%s]([%d]+)")
diff --git a/widgets/hddtemp.lua b/widgets/hddtemp.lua
index e5ab96d..7559512 100644
--- a/widgets/hddtemp.lua
+++ b/widgets/hddtemp.lua
@@ -20,9 +20,8 @@ local function worker(format, warg)
-- Fallback to default hddtemp warg
if warg == nil then warg = 7634 end
- -- Get info from the hddtemp daemon
+ local hdd_temp = {} -- Get info from the hddtemp daemon
local f = io.popen("curl --connect-timeout 1 -fsm 3 telnet://127.0.0.1:"..warg)
- local hdd_temp = {}
for line in f:lines() do
for d, t in string.gmatch(line, "|([%/%a%d]+)|.-|([%d]+)|[CF]+|") do
diff --git a/widgets/mbox.lua b/widgets/mbox.lua
index efd3a42..475d018 100644
--- a/widgets/mbox.lua
+++ b/widgets/mbox.lua
@@ -20,6 +20,9 @@ module("vicious.widgets.mbox")
local function worker(format, warg)
if not warg then return end
+ -- Default value
+ local subject = "N/A"
+
-- mbox could be huge, get a 30kb chunk from EOF
if type(warg) ~= "table" then mbox = warg end
-- * attachment could be much bigger than 30kb
@@ -28,9 +31,6 @@ local function worker(format, warg)
local txt = f:read("*all")
f:close()
- -- Default value
- local subject = "N/A"
-
-- Find all Subject lines
for i in string.gfind(txt, "Subject: ([^\n]*)") do
subject = i
diff --git a/widgets/uptime.lua b/widgets/uptime.lua
index ebc5af8..e0bdc3b 100644
--- a/widgets/uptime.lua
+++ b/widgets/uptime.lua
@@ -26,8 +26,7 @@ local function worker(format)
local up_h = math.floor((up_t % (3600 * 24)) / 3600)
local up_m = math.floor(((up_t % (3600 * 24)) % 3600) / 60)
- -- Get load averages
- local l1, l5, l15 = -- Get load averages for past 1, 5 and 15 minutes
+ local l1, l5, l15 = -- Get load averages for past 1, 5 and 15 minutes
string.match(proc.loadavg, "([%d]*%.[%d]*)%s([%d]*%.[%d]*)%s([%d]*%.[%d]*)")
return {up_d, up_h, up_m, l1, l5, l15}