1 ----------------------------------------------------------------------------
2 -- @author Julien Danjou <julien@danjou.info>
3 -- @copyright 2008 Julien Danjou
4 -- @release @AWESOME_VERSION@
5 ----------------------------------------------------------------------------
10 local setmetatable
= setmetatable
11 local util
= require("awful.util")
12 local hooks
= require("awful.hooks")
20 --- Root window image display library
23 command
= "wget -q -O "
27 -- Update a telak wibox.
28 -- @param w The wibox to update.
29 local function update(w
)
30 local tmp
= os
.tmpname()
31 os
.execute(command
.. tmp
.. " '" .. data
[w
].image
.. "'")
32 local img
= capi
.image(tmp
)
34 w
:geometry({ width
= img
.width
, height
= img
.height
})
42 --- Create a new telak wibox. This will be automagically update to show a
43 -- local or remote image.
44 -- @param args A table with arguments: image is the local or remote image.
45 -- Timer can be specified to set the time in seconds between two update.
46 -- Default is 300 seconds.
47 -- @return The wibox. You need to attach it to a screen and to set its
48 -- coordinates as you want.
49 local function new(_
, args
)
50 if not args
or not args
.image
then return end
53 local w
= capi
.wibox({ position
= "floating" })
54 data
[w
] = { image
= args
.image
}
55 local wimg
= capi
.widget({ type = "imagebox" })
58 data
[w
].cb
= function () update(w
) end
59 hooks
.timer
.register(args
.timer
or 3, data
[w
].cb
)
66 --- Delete a telak wibox.
67 -- @param w The wibox.
70 hooks
.timer
.unregister(data
[w
].cb
)
75 setmetatable(_M
, { __call
= new
})
77 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80