Skip to content

Commit

Permalink
Add signal handling in declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
ojv committed May 17, 2017
1 parent 308a39c commit 2dd8aa1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ local widget = { -- for the widget that awesome draws
-- for declaring subwidget properties
SUBW_DECL = Set({ "conkybox", "iconbox", "labelbox", "background" }),
-- for declaring a conky widget
CONKY_DECL = Set({ "conky", "icon", "label", "updater", "buttons" }),
CONKY_DECL = Set({ "conky", "icon", "label", "updater", "buttons", "signals" }),
}
local updater = {} -- for updating the widget
local window = {} -- for conky's own window
Expand Down Expand Up @@ -201,6 +201,12 @@ function widget.make(raw) -- {{{2
root:buttons(buttons)
end

if raw.signals then
for signal, func in pairs(raw.signals) do
root:connect_signal(signal, func)
end
end

return root
end

Expand Down Expand Up @@ -372,7 +378,7 @@ function updater.add(conkybox, iconbox, labelbox, background, func) -- {{{2
local labelbox = labelbox
local background = background
local func = func or function(result, conky, icon, label, background)
conky:set_text(result)
conky:set_text(result or "")
end
local last_update = nil

Expand Down

0 comments on commit 2dd8aa1

Please sign in to comment.