telak: use luasocket instead of external wget

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Leon Winter 2008-12-14 11:26:34 +01:00 committed by Julien Danjou
parent fc91497d2f
commit f49ce21335
1 changed files with 4 additions and 3 deletions

View File

@ -6,6 +6,9 @@
-- Grab environment
local os = os
local io = io
local http = require("socket.http")
local ltn12 = require("ltn12")
local otable = otable
local setmetatable = setmetatable
local util = require("awful.util")
@ -20,15 +23,13 @@ local capi =
--- Root window image display library
module("telak")
command = "wget -q -O "
local data = otable()
-- Update a telak wibox.
-- @param w The wibox to update.
local function update(w)
local tmp = os.tmpname()
os.execute(command .. tmp .. " '" .. data[w].image .. "'")
http.request{url = data[w].image, sink = ltn12.sink.file(io.open(tmp, "w"))}
local img = capi.image(tmp)
if img then
w:geometry({ width = img.width, height = img.height })