doc: Fix an error in the declarative guide
`vicious.register(w, f(args))` -> `vicious.register(self, f(args))` Also add the monkeypatch to other widgets, it makes it more useful
This commit is contained in:
parent
20c132fa38
commit
d6412b96fd
|
@ -227,11 +227,15 @@ caught by a Lua `metatable` (operator overload).
|
||||||
|
|
||||||
Code:
|
Code:
|
||||||
|
|
||||||
-- "Monkeypatch" a new function to wibox.widget.textbox to add vicious
|
-- "Monkeypatch" a new function to 3 widget classes to add vicious
|
||||||
-- extension support
|
-- extension support
|
||||||
function wibox.widget.textbox:vicious(args)
|
for _, wdg in ipairs {
|
||||||
|
wibox.widget.textbox , wibox.widget.progressbar, wibox.widget.graph
|
||||||
|
} do
|
||||||
|
function wdg:vicious(args)
|
||||||
local f = unpack or table.unpack -- Lua 5.1 compat
|
local f = unpack or table.unpack -- Lua 5.1 compat
|
||||||
vicious.register(w, f(args))
|
vicious.register(self, f(args))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
s.mywibox : setup {
|
s.mywibox : setup {
|
||||||
|
|
Loading…
Reference in New Issue