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

View File

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

View File

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

View File

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

View File

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

View File

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

3
fs.lua
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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