1 ---------------------------------------------------------------------------
2 -- @author Julien Danjou <julien@danjou.info>
3 -- @copyright 2009 Julien Danjou
4 -- @release @AWESOME_VERSION@
5 ---------------------------------------------------------------------------
7 local setmetatable
= setmetatable
9 local capi
= { widget
= widget
,
12 --- Text clock widget.
13 module("awful.widget.textclock")
15 --- Create a textclock widget. It draws the time it is in a textbox.
16 -- @param args Standard arguments for textbox widget.
17 -- @param format The time format. Default is " %a %b %d, %H:%M ".
18 -- @param timeout How often update the time. Default is 60.
19 -- @return A textbox widget.
20 function new(args
, format, timeout
)
21 local args
= args
or {}
22 local format = format or " %a %b %d, %H:%M "
23 local timeout
= timeout
or 60
25 local w
= capi
.widget(args
)
26 local timer
= capi
.timer
{ timeout
= timeout
}
27 w
.text
= os
.date(format)
28 timer
:add_signal("timeout", function() w
.text
= os
.date(format) end)
33 setmetatable(_M
, { __call
= function(_
, ...) return new(...) end })
35 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80