-- }}}
-- {{{ Signals
+function warp_mouse(c)
+ local o = awful.mouse.client_under_pointer()
+ if not o or o ~= c then
+ local g = c:geometry()
+ mouse.coords({ x = g.x + 5, y = g.y + 5 }, true)
+ end
+end
+
client.add_signal("focus", function (c)
if not awful.client.ismarked(c) then
c.border_color = beautiful.border_focus
end
+ warp_mouse(c)
end)
client.add_signal("unfocus", function (c)
end)
client.add_signal("manage", function (c, startup)
- -- Enable sloppy focus
- c:add_signal("mouse::enter", function(c)
- client.focus = c
- end)
-
- -- Focus new clients
- client.focus = c
+ c:add_signal("mouse::enter", function(c) client.focus = c end)
end)
-function warp_mouse(screen)
- local c = client.focus
-
- if c then
- local o = awful.mouse.client_under_pointer()
- if not o or o ~= c then
- local g = c:geometry()
- mouse.coords { x = g.x + 5, y = g.y + 5 }
- end
- end
-end
-
for s = 1, screen.count() do
- -- screen[s]:add_signal("arrange", warp_mouse)
+ screen[s]:add_signal("arrange", function ()
+ if client.focus and client.focus.screen == s then
+ warp_mouse(client.focus)
+ end
+ end)
end
-- }}}