diff --git a/lib/awful/tooltip.lua.in b/lib/awful/tooltip.lua.in index 341426fe..b84fc8ec 100644 --- a/lib/awful/tooltip.lua.in +++ b/lib/awful/tooltip.lua.in @@ -164,6 +164,8 @@ end -- @tparam function args.timer_function A function to dynamically change the -- tooltip text. -- @tparam table args.objects A list of objects linked to the tooltip. +-- @tparam number args.delay_show Delay showing the tooltip by this many +-- seconds. -- @return The created tooltip. -- @see add_to_object -- @see set_timeout @@ -176,9 +178,20 @@ tooltip.new = function(args) } -- private data + local delay_timeout + if args.delay_show then + delay_timeout = timer { timeout = args.delay_show } + delay_timeout:connect_signal("timeout", function () show(self) end) + end data[self] = { - show = function() show(self) end, - hide = function() hide(self) end + show = function() + if delay_timeout then delay_timeout:start() + else show(self) end + end, + hide = function() + if delay_timeout then delay_timeout:stop() end + hide(self) + end, } -- export functions