Hi, add_signal is now connect_signal
See the wiki On Fri, Jan 4, 2013 at 9:40 AM, Stefano Di Martino <[email protected]>wrote: > On 03.01.2013 13:36, Piotr Adamus wrote: > >> Hello, >> >> I think you must rewrite your widgets: >> >> "widget" Library Changes >> >> "widget" Library Replacement >> There is no longer a thing like widget in the API, so different >> widgets which were provided by its type parameter can be found in >> different places. >> One of them is a new module named wibox. Please note that wibox is no >> longer a part of the standard API, so you need to require("wibox") to >> use it. >> textbox >> Migrated to wibox.widget.textbox() >> imagebox >> Migrated to wibox.widget.imagebox() >> systray >> Migrated to wibox.widget.systray() >> >> Kr. >> >> Piotr. >> > > Hi Piotr, > thx, for your reply. I tried to port this, but I get the following error > on line 41: > > "attempt to call method 'add_signal' (a nil value)" > > It's about the timer module which was already deprecated on awesome 3.4. > Maybe someone can handle this? > > 1 local wibox = require("wibox") > 2 local awful = require("awful") > 3 --local timer = require("timer") > 4 > 5 volume_widget = wibox.widget.textbox() > 6 volume_widget:set_align("**right") > 7 > 8 function update_volume(widget) > 9 local fd = io.popen("amixer sget Master") > 10 local status = fd:read("*all") > 11 fd:close() > 12 > 13 local volume = tonumber(string.match(status, "(%d?%d?%d)%%")) / 100 > 14 -- volume = string.format("% 3d", volume) > 15 > 16 status = string.match(status, "%[(o[^%]]*)%]") > 17 > 18 -- starting colour > 19 local sr, sg, sb = 0x3F, 0x3F, 0x3F > 20 -- ending colour > 21 local er, eg, eb = 0xDC, 0xDC, 0xCC > 22 > 23 local ir = volume * (er - sr) + sr > 24 local ig = volume * (eg - sg) + sg > 25 local ib = volume * (eb - sb) + sb > 26 interpol_colour = string.format("%.2x%.2x%.2x", ir, ig, ib) > 27 if string.find(status, "on", 1, true) then > 28 volume = " <span background='#" .. interpol_colour .. "'> > </span>" > 29 else > 30 volume = " <span color='red' background='#" .. interpol_colour > .. "'> M </span>" > 31 end > 32 widget:set_text(volume) > 33 end > 34 > 35 update_volume(volume_widget) > 36 --awful.hooks.timer.register(**1, function () > update_volume(volume_widget) end) > 37 > 38 mytimer = timer({ timeout = 1 }) > 39 > 40 -- error: attempt to call method 'add_signal' (a nil value) > 41 mytimer:add_signal("timeout", function () update_volume(volume_widget) > end) > 42 mytimer:start() > > Best regards > > Stefano > > -- > To unsubscribe, send mail to > awesome-unsubscribe@naquadah.**org<[email protected]> > . >
