summaryrefslogtreecommitdiff
path: root/func/warpcursor.lua
blob: f1a46bd2c1a1e75560d817016ace2915800621f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function warp_cursor(c)
--	if c ~= client.focus or not c.warp_cursor then
	if not c.warp_cursor then
		return
	end

	-- dont allow moving mouse unless it is over another client or over nothing
	local canmovemouse = mouse.current_client or (mouse.current_wibox or mouse.current_widget) == nil

	if canmovemouse and mouse.current_client ~= c then
		mouse.coords {
			x = c.x + (c.width  / 2),
			y = c.y + (c.height / 2),
		}
	end
end

client.connect_signal("focus", warp_cursor)
--client.connect_signal("property::size", warp_cursor)
--client.connect_signal("property::position", warp_cursor)

return warp_cursor