From 5603d93da6bda0f15673d6d613733d8e40e92042 Mon Sep 17 00:00:00 2001 From: koniu Date: Tue, 25 Nov 2008 00:14:29 +0000 Subject: [PATCH] naughty: hover_timeout can now be used in notify() Signed-off-by: koniu --- lib/naughty.lua.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index 021efec4..59f18e51 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -205,6 +205,7 @@ end -- @param ontop Target screen for the notification -- @param run Function to run on left click -- @param width The popup width +-- @field hover_timeout Delay in seconds after which hovered popup disappears. -- @param replaces_id Replace the notification with the given ID -- @usage naughty.notify({ title = 'Achtung!', text = 'You\'re idling', timeout = 0 }) -- @return The notification object @@ -217,6 +218,7 @@ function notify(args) local screen = args.screen or config.screen local ontop = args.ontop or config.ontop local width = args.width or config.width + local hover_timeout = args.hover_timeout or config.hover_timeout -- beautiful local beautiful = bt.get() @@ -260,8 +262,8 @@ function notify(args) local run = args.run or die local hover_destroy = function () - if config.hover_timeout == 0 then die() - else hooks.timer.register(config.hover_timeout, die) end + if hover_timeout == 0 then die() + else hooks.timer.register(hover_timeout, die) end end -- create textbox @@ -269,7 +271,7 @@ function notify(args) textbox:buttons({ button({ }, 1, run), button({ }, 3, die) }) textbox.text = string.format('%s%s', font, title, text) - if config.hover_timeout then textbox.mouse_enter = hover_destroy end + if hover_timeout then textbox.mouse_enter = hover_destroy end -- create iconbox local iconbox = nil @@ -287,7 +289,7 @@ function notify(args) end iconbox.resize = false iconbox.image = img - if config.hover_timeout then iconbox.mouse_enter = hover_destroy end + if hover_timeout then iconbox.mouse_enter = hover_destroy end end end