signals: put cursor in the middle left of the focused window

Previously, cursor was put in the upper left corner but there are so
many stuff that may display tooltips at this place...
This commit is contained in:
Vincent Bernat 2015-08-15 10:38:37 +02:00
parent a5f5530c85
commit f04a53528f

View file

@ -4,17 +4,11 @@ local icons = loadrc("icons", "vbe/icons")
local focus_from_mouse = false local focus_from_mouse = false
local function mouse_follow_focus(c) local function mouse_follow_focus(c)
-- Move the mouse to the top left corner -- Move the mouse to the top left corner
local margin = function()
if c.class == "Chromium" or c.class == "Emacs" then return 30
else return 10
end
end
margin = margin()
if c.type ~= "dialog" then if c.type ~= "dialog" then
local cc = c:geometry() local cc = c:geometry()
local _, x, y = awful.mouse.client.corner(nil, "top_left") local _, x, y = awful.mouse.client.corner(nil, "top_left")
if x and y and cc.width > margin * 2 and cc.height > margin * 2 then if x and y then
mouse.coords({ x = x + margin , y = y + margin }, true) mouse.coords({ x = x + 20 , y = y + cc.height / 2 }, true)
end end
end end
end end