awful.tooltip: add "delay_show" arg
This will wrap the show and hide methods using gears.timeout.
This commit is contained in:
parent
c26a96177d
commit
5d0fc566e9
|
@ -164,6 +164,8 @@ end
|
||||||
-- @tparam function args.timer_function A function to dynamically change the
|
-- @tparam function args.timer_function A function to dynamically change the
|
||||||
-- tooltip text.
|
-- tooltip text.
|
||||||
-- @tparam table args.objects A list of objects linked to the tooltip.
|
-- @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.
|
-- @return The created tooltip.
|
||||||
-- @see add_to_object
|
-- @see add_to_object
|
||||||
-- @see set_timeout
|
-- @see set_timeout
|
||||||
|
@ -176,9 +178,20 @@ tooltip.new = function(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
-- private data
|
-- 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] = {
|
data[self] = {
|
||||||
show = function() show(self) end,
|
show = function()
|
||||||
hide = function() hide(self) end
|
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
|
-- export functions
|
||||||
|
|
Loading…
Reference in New Issue