From a248cdc0ab9777f5ba23e6bbd34a1db96114bb45 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 27 Feb 2018 16:13:12 +1300 Subject: [PATCH 1/1] Move mouse pointer to area only if not already within --- .config/awesome/rc.lua | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 -- }}} -- 2.39.5