naughty: hover_timeout can now be used in notify()
Signed-off-by: koniu <gkusnierz@gmail.com>
This commit is contained in:
parent
fd0e1022bb
commit
5603d93da6
|
@ -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('<margin right="'..config.margin..'" left="'..config.margin..'"/><span font_desc="%s"><b>%s</b>%s</span>', 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
|
||||
|
||||
|
|
Loading…
Reference in New Issue