From: martin f. krafft Date: Tue, 27 Feb 2018 03:13:12 +0000 (+1300) Subject: Move mouse pointer to area only if not already within X-Git-Url: https://git.madduck.net/etc/awesome.git/commitdiff_plain/a248cdc0ab9777f5ba23e6bbd34a1db96114bb45?ds=sidebyside Move mouse pointer to area only if not already within --- diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 3c7cdf3..4a16329 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -115,11 +115,18 @@ local function set_wallpaper(s) end end -local function centre_mouse_on_area(a) - mouse.coords({ - x = a.x + a.width/2, - y = a.y + a.height/2, - }, true) +local function move_mouse_to_area(a) + local coords = mouse.coords() + if (coords.x < a.x or + coords.x > (a.x+a.width) or + coords.y < a.y or + coords.y > (a.y+a.height)) then + + mouse.coords({ + x = a.x + a.width/2, + y = a.y + a.height/2, + }, true) + end end -- }}}