From e899ca769610c01073c148112b8e8e5bb72fba45 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 30 Jun 2009 12:30:45 +0200 Subject: [PATCH] naughty: use timer Signed-off-by: Julien Danjou --- lib/naughty.lua.in | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index 2e51b813..9c7b1ddf 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -14,7 +14,8 @@ local capi = { screen = screen, dbus = dbus, widget = widget, wibox = wibox, - image = image } + image = image, + timer = timer } local hooks = require("awful.hooks") local button = require("awful.button") local util = require("awful.util") @@ -175,7 +176,7 @@ function destroy(notification) if notification and notification.box.screen then local scr = notification.box.screen table.remove(notifications[notification.box.screen][notification.position], notification.idx) - hooks.timer.unregister(notification.die) + notification.timer:stop() notification.box.screen = nil arrange(scr) return true @@ -293,9 +294,12 @@ function notify(args) if title then title = title .. "\n" else title = "" end -- hook destroy + local timer_die = capi.timer { timeout = timeout } local die = function () destroy(notification) end - hooks.timer.register(timeout, die) + timer_die:add_signal("timeout", die) + timer_die:start() notification.die = die + notification.timer = timer_die local run = function () if args.run then @@ -307,7 +311,7 @@ function notify(args) local hover_destroy = function () if hover_timeout == 0 then die() - else hooks.timer.register(hover_timeout, die) end + else timer_die:stop() end end -- create textbox