init: do not use keyword type for user data
This commit is contained in:
parent
ee64644ddc
commit
5f41c7a238
6
README
6
README
|
@ -31,13 +31,13 @@ Then add the following to the top of your rc.lua:
|
|||
Once you create a widget (a textbox, graph or a progressbar) call
|
||||
vicious.register() to register it with vicious:
|
||||
|
||||
vicious.register(widget, type, format, interval, warg)
|
||||
vicious.register(widget, wtype, format, interval, warg)
|
||||
|
||||
widget
|
||||
- widget created with widget() or awful.widget() (in case of a
|
||||
graph or a progressbar)
|
||||
|
||||
type
|
||||
wtype
|
||||
- one of the available widget types, see below for a list
|
||||
|
||||
format
|
||||
|
@ -78,7 +78,7 @@ Restart suspended widgets:
|
|||
- if widget is provided only that widget will be activated
|
||||
|
||||
Enable caching of a widget type:
|
||||
vicious.cache(type)
|
||||
vicious.cache(wtype)
|
||||
|
||||
- enable caching of values returned by a widget type
|
||||
|
||||
|
|
16
init.lua
16
init.lua
|
@ -93,16 +93,16 @@ local function update(widget, reg, disablecache)
|
|||
local data = {}
|
||||
|
||||
-- Check for chached output newer than the last update
|
||||
if widget_cache[reg.type] ~= nil then
|
||||
local c = widget_cache[reg.type]
|
||||
if widget_cache[reg.wtype] ~= nil then
|
||||
local c = widget_cache[reg.wtype]
|
||||
|
||||
if (c.time == nil or c.time <= t-reg.timer) or disablecache then
|
||||
c.time, c.data = t, reg.type(reg.format, reg.warg)
|
||||
c.time, c.data = t, reg.wtype(reg.format, reg.warg)
|
||||
end
|
||||
|
||||
data = c.data
|
||||
else
|
||||
data = reg.type(reg.format, reg.warg)
|
||||
data = reg.wtype(reg.format, reg.warg)
|
||||
end
|
||||
|
||||
if type(data) == "table" then
|
||||
|
@ -179,7 +179,7 @@ function register(widget, wtype, format, timer, warg)
|
|||
local widget = widget
|
||||
|
||||
-- Set properties
|
||||
reg.type = wtype
|
||||
reg.wtype = wtype
|
||||
reg.format = format
|
||||
reg.timer = timer
|
||||
reg.warg = warg
|
||||
|
@ -240,9 +240,9 @@ end
|
|||
-- }}}
|
||||
|
||||
-- {{{ Enable caching of a widget type
|
||||
function cache(type)
|
||||
if widget_cache[type] == nil then
|
||||
widget_cache[type] = {}
|
||||
function cache(wtype)
|
||||
if widget_cache[wtype] == nil then
|
||||
widget_cache[wtype] = {}
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
|
|
Loading…
Reference in New Issue