Make all widgets return their worker functions when called.

This commit is contained in:
Adrian C. (anrxc) 2009-08-01 23:11:41 +02:00
parent 1630b786d4
commit 418151f57e
21 changed files with 64 additions and 1 deletions

View File

@ -6,6 +6,7 @@
-- {{{ Grab environment
local tonumber = tonumber
local io = { open = io.open }
local setmetatable = setmetatable
local math = { floor = math.floor }
local string = {
find = string.find,
@ -77,3 +78,5 @@ function worker(format, batid)
end
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { popen = io.popen }
local setmetatable = setmetatable
local table = { insert = table.insert }
-- }}}
@ -46,3 +47,5 @@ function worker(format)
return battery_info
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -8,6 +8,7 @@ local type = type
local pairs = pairs
local ipairs = ipairs
local io = { open = io.open }
local setmetatable = setmetatable
local math = { floor = math.floor }
local table = { insert = table.insert }
local helpers = require("vicious.helpers")
@ -93,3 +94,5 @@ function worker(format, padding)
return cpu_usage
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -5,6 +5,7 @@
-- {{{ Grab environment
local os = { date = os.date }
local setmetatable = setmetatable
-- }}}
@ -22,3 +23,5 @@ function worker(format)
end
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -7,6 +7,7 @@
local type = type
local ipairs = ipairs
local io = { open = io.open }
local setmetatable = setmetatable
local math = { floor = math.floor }
local table = { insert = table.insert }
-- }}}
@ -71,3 +72,5 @@ function worker(format, disk)
return disk_usage
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { open = io.open }
local setmetatable = setmetatable
local math = { floor = math.floor }
local string = { format = string.format }
-- }}}
@ -35,3 +36,5 @@ function worker(format, poolsize)
return {ent_avail, ent_avail_percent}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

3
fs.lua
View File

@ -6,6 +6,7 @@
-- {{{ Grab environment
local type = type
local io = { popen = io.popen }
local setmetatable = setmetatable
local helpers = require("vicious.helpers")
-- }}}
@ -54,3 +55,5 @@ function worker(format, padding)
return args
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { open = io.open }
local setmetatable = setmetatable
-- }}}
@ -26,3 +27,5 @@ function worker(format)
return {avg1, avg5, avg15}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { open = io.open }
local setmetatable = setmetatable
local string = { gfind = string.gfind }
local helpers = require("vicious.helpers")
-- }}}
@ -43,3 +44,5 @@ function worker(format, mbox)
end
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { open = io.open }
local setmetatable = setmetatable
local string = { find = string.find }
-- }}}
@ -55,3 +56,5 @@ function worker(format, mbox)
return {total, old, new}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -6,6 +6,7 @@
-- {{{ Grab environment
local io = { popen = io.popen }
local setmetatable = setmetatable
-- }}}
@ -42,3 +43,5 @@ function worker(format, mdir)
return {newcount, curcount}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -7,6 +7,7 @@
local type = type
local tonumber = tonumber
local io = { open = io.open }
local setmetatable = setmetatable
local math = { floor = math.floor }
local helpers = require("vicious.helpers")
-- }}}
@ -74,3 +75,5 @@ function worker(format, padding)
swap_usepercent, swap_inuse, swap_total, swap_free}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { popen = io.popen }
local setmetatable = setmetatable
local helpers = require("vicious.helpers")
-- }}}
@ -14,7 +15,7 @@ module("vicious.mpd")
-- {{{ MPD widget type
function worker()
function worker(format)
-- This one is as simple as they come. Using sockets or expanding
-- it is a lost cause since there are already a few MPD Lua libs
-- written for awesome. Use them.
@ -40,3 +41,5 @@ function worker()
return {nowplaying}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -7,6 +7,7 @@
local tonumber = tonumber
local os = { time = os.time }
local io = { open = io.open }
local setmetatable = setmetatable
local math = { floor = math.floor }
local helpers = require("vicious.helpers")
-- }}}
@ -113,3 +114,5 @@ function worker(format, padding)
return args
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -6,6 +6,7 @@
-- {{{ Grab environment
local io = { open = io.open }
local setmetatable = setmetatable
local string = { find = string.find }
local os = {
time = os.time,
@ -68,3 +69,5 @@ function worker(format, files)
return {count.past, count.today, count.soon, count.future}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -6,6 +6,7 @@
-- {{{ Grab environment
local tonumber = tonumber
local io = { popen = io.popen }
local setmetatable = setmetatable
-- }}}
@ -36,3 +37,5 @@ function worker(format)
return {updates}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { open = io.open }
local setmetatable = setmetatable
-- }}}
@ -25,3 +26,5 @@ function worker(format, thermal_zone)
return {temperature}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -6,6 +6,7 @@
-- {{{ Grab environment
local tonumber = tonumber
local io = { open = io.open }
local setmetatable = setmetatable
local math = { floor = math.floor }
local helpers = require("vicious.helpers")
-- }}}
@ -49,3 +50,5 @@ function worker(format, padding)
return {total_uptime, uptime_days, uptime_hours, uptime_minutes, uptime_seconds}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { popen = io.popen }
local setmetatable = setmetatable
local string = { match = string.match }
-- }}}
@ -31,3 +32,5 @@ function worker(format, channel)
return {volume_level}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { popen = io.popen }
local setmetatable = setmetatable
local math = { floor = math.floor }
local string = { match = string.match }
-- }}}
@ -73,3 +74,5 @@ function worker(format, station)
return weather
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })

View File

@ -5,6 +5,7 @@
-- {{{ Grab environment
local io = { popen = io.popen }
local setmetatable = setmetatable
local string = {
find = string.find,
match = string.match
@ -60,3 +61,5 @@ function worker(format, iface)
return winfo
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })