From 2fda9f5a2e76a1184e1940eeef1fd169455a1c31 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 20 Aug 2009 18:07:30 +0200 Subject: [PATCH] naughty: fix timeout = 0 Signed-off-by: Julien Danjou --- lib/naughty.lua.in | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index 97eebe5a6..a4809df36 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -174,7 +174,9 @@ 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) - notification.timer:stop() + if notification.timer then + notification.timer:stop() + end notification.box.screen = nil arrange(scr) return true @@ -292,12 +294,14 @@ 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 - timer_die:add_signal("timeout", die) - timer_die:start() + if timeout > 0 then + local timer_die = capi.timer { timeout = timeout } + timer_die:add_signal("timeout", die) + timer_die:start() + notification.timer = timer_die + end notification.die = die - notification.timer = timer_die local run = function () if args.run then @@ -308,8 +312,11 @@ function notify(args) end local hover_destroy = function () - if hover_timeout == 0 then die() - else timer_die:stop() end + if hover_timeout == 0 then + die() + elseif timer_die then + timer_die:stop() + end end -- create textbox