refactor
This commit is contained in:
parent
08ffc36589
commit
66e9aa0142
25
init.lua
25
init.lua
|
@ -4,11 +4,15 @@ local gears = require('gears')
|
||||||
|
|
||||||
-------------------------------------------------------------------> methods ;
|
-------------------------------------------------------------------> methods ;
|
||||||
|
|
||||||
local mouser = function ()
|
local micky = function ()
|
||||||
gears.timer.weak_start_new(0.05, function()
|
gears.timer.weak_start_new(0.05, function()
|
||||||
local c = client.focus
|
local c = client.focus
|
||||||
local cgeometry = c:geometry()
|
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)
|
||||||
end
|
end
|
||||||
--+ relocate mouse after slightly waiting for focus to
|
--+ relocate mouse after slightly waiting for focus to
|
||||||
|
@ -25,12 +29,12 @@ client.connect_signal("focus", function(c)
|
||||||
local current_client = mouse.current_client
|
local current_client = mouse.current_client
|
||||||
|
|
||||||
if not current_client then
|
if not current_client then
|
||||||
mouser() return false
|
micky() return false
|
||||||
end
|
end
|
||||||
--+ nothing under the mouse, move directly
|
--+ nothing under the mouse, move directly
|
||||||
|
|
||||||
if focused_client ~= current_client then
|
if focused_client ~= current_client then
|
||||||
mouser() return false
|
micky() return false
|
||||||
end
|
end
|
||||||
--+ no need to relocate the mouse if already over
|
--+ no need to relocate the mouse if already over
|
||||||
--> the client.
|
--> the client.
|
||||||
|
@ -44,19 +48,18 @@ client.connect_signal("unmanage", function(c)
|
||||||
local current_client = mouse.current_client
|
local current_client = mouse.current_client
|
||||||
|
|
||||||
if current_client and c ~= current_client then
|
if current_client and c ~= current_client then
|
||||||
mouser()
|
micky()
|
||||||
end
|
end
|
||||||
--+ no need to relocate the mouse if already over the
|
--+ no need for the callback here.
|
||||||
--> client.
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
---------------------------------------------------------------------> export ;
|
---------------------------------------------------------------------> export ;
|
||||||
|
|
||||||
return mouser
|
return micky
|
||||||
|
|
||||||
-- [*] can also manually invoke the function through
|
--+ can also manually invoke the function through
|
||||||
-- shortcuts, but this is not necessary with this new
|
--> shortcuts, but this is not necessary with this new
|
||||||
-- version.
|
--> version.
|
||||||
|
|
||||||
-- awful.key({}, 'XF86HomePage', function ()
|
-- awful.key({}, 'XF86HomePage', function ()
|
||||||
-- awful.client.run_or_raise(chromium, matcher('Google-chrome'))
|
-- awful.client.run_or_raise(chromium, matcher('Google-chrome'))
|
||||||
|
|
Loading…
Reference in New Issue