From 14e63fbcd7bd444a9b6afa8ccaa3eb69a65c4fcd Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 29 Jul 2015 20:59:43 +0200 Subject: [PATCH] awful.tooltip: do not hide when entering its wibox Because of `placement.under_mouse` (and without `placement.no_offscreen` fixing it), this will cause the tooltip to hide immediately again. There is no need for hooking into this signal, but this adds a click handler to close the tooltip when clicking into it. --- lib/awful/tooltip.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/awful/tooltip.lua b/lib/awful/tooltip.lua index 79a83542..2f4b1248 100644 --- a/lib/awful/tooltip.lua +++ b/lib/awful/tooltip.lua @@ -45,6 +45,7 @@ local screen = screen local timer = require("gears.timer") local wibox = require("wibox") local a_placement = require("awful.placement") +local abutton = require("awful.button") local beautiful = require("beautiful") local textbox = require("wibox.widget.textbox") local background = require("wibox.widget.background") @@ -270,8 +271,9 @@ tooltip.new = function(args) self.marginbox = wibox.layout.margin(self.background, m_lr, m_lr, m_tb, m_tb) self.wibox:set_widget(self.marginbox) - -- add some signals on both the tooltip and widget - self.wibox:connect_signal("mouse::enter", data[self].hide) + -- Close the tooltip when clicking it. This gets done on release, to not + -- emit the release event on an underlying object, e.g. the titlebar icon. + self.wibox:buttons(abutton({}, 1, nil, function() data[self].hide() end)) -- Add tooltip to objects if args.objects then