From 66e9aa0142a5b58ff255f259b388d0b4ad252509 Mon Sep 17 00:00:00 2001 From: anakha Date: Fri, 4 Jun 2021 02:57:52 -0400 Subject: [PATCH] refactor --- init.lua | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/init.lua b/init.lua index 1f21998..c58ec25 100644 --- a/init.lua +++ b/init.lua @@ -4,11 +4,15 @@ local gears = require('gears') -------------------------------------------------------------------> methods ; -local mouser = function () +local micky = function () gears.timer.weak_start_new(0.05, function() local c = client.focus local cgeometry = c:geometry() - mouse.coords({ x = cgeometry.x + cgeometry.width/2 , y = cgeometry.y + cgeometry.height/2 }) + + mouse.coords({ + x = cgeometry.x + cgeometry.width / 2, + y = cgeometry.y + cgeometry.height / 2 + }) end) end --+ relocate mouse after slightly waiting for focus to @@ -25,12 +29,12 @@ client.connect_signal("focus", function(c) local current_client = mouse.current_client if not current_client then - mouser() return false + micky() return false end --+ nothing under the mouse, move directly if focused_client ~= current_client then - mouser() return false + micky() return false end --+ no need to relocate the mouse if already over --> the client. @@ -44,19 +48,18 @@ client.connect_signal("unmanage", function(c) local current_client = mouse.current_client if current_client and c ~= current_client then - mouser() + micky() end - --+ no need to relocate the mouse if already over the - --> client. + --+ no need for the callback here. end) ---------------------------------------------------------------------> export ; -return mouser +return micky --- [*] can also manually invoke the function through --- shortcuts, but this is not necessary with this new --- version. +--+ can also manually invoke the function through +--> shortcuts, but this is not necessary with this new +--> version. -- awful.key({}, 'XF86HomePage', function () -- awful.client.run_or_raise(chromium, matcher('Google-chrome'))