refactor
This commit is contained in:
parent
b11225f377
commit
e5029ca26e
27
init.lua
27
init.lua
|
@ -7,6 +7,7 @@ local inspect = require('inspect')
|
||||||
|
|
||||||
local stay_classes = {
|
local stay_classes = {
|
||||||
awesome
|
awesome
|
||||||
|
-- taskbar
|
||||||
}
|
}
|
||||||
--+ class names defined here would insist micky stays where
|
--+ class names defined here would insist micky stays where
|
||||||
--> he is at.
|
--> he is at.
|
||||||
|
@ -35,8 +36,6 @@ end
|
||||||
---------------------------------------------------------------------> signal ;
|
---------------------------------------------------------------------> signal ;
|
||||||
|
|
||||||
client.connect_signal("focus", function(c)
|
client.connect_signal("focus", function(c)
|
||||||
-- naughty.notify({text=inspect(mouse.coords())})
|
|
||||||
|
|
||||||
local focused_client = c
|
local focused_client = c
|
||||||
--+ client the focus is going towards
|
--+ client the focus is going towards
|
||||||
|
|
||||||
|
@ -48,17 +47,17 @@ client.connect_signal("focus", function(c)
|
||||||
--+ exclusions
|
--+ exclusions
|
||||||
|
|
||||||
if not client_under_mouse then
|
if not client_under_mouse then
|
||||||
micky() return false
|
micky()
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
--+ nothing under the mouse, move directly
|
--+ nothing under the mouse, move directly
|
||||||
|
|
||||||
|
|
||||||
if focused_client ~= client_under_mouse then
|
if focused_client ~= client_under_mouse then
|
||||||
micky() 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.
|
||||||
|
|
||||||
end)
|
end)
|
||||||
--+ mouse.current_client would point to the previous
|
--+ mouse.current_client would point to the previous
|
||||||
--> client without the callback.
|
--> client without the callback.
|
||||||
|
@ -67,9 +66,12 @@ end)
|
||||||
|
|
||||||
client.connect_signal("unmanage", function(c)
|
client.connect_signal("unmanage", function(c)
|
||||||
local client_under_mouse = mouse.current_client
|
local client_under_mouse = mouse.current_client
|
||||||
-- naughty.notify({text=inspect(c:geometry())})
|
|
||||||
|
|
||||||
if client_under_mouse and c ~= client_under_mouse then
|
if not client_under_mouse then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if client_under_mouse ~= c then
|
||||||
micky()
|
micky()
|
||||||
end
|
end
|
||||||
--+ no need for the callback here.
|
--+ no need for the callback here.
|
||||||
|
@ -89,10 +91,17 @@ return micky
|
||||||
-- end),
|
-- end),
|
||||||
-- naughty.notify({text=current_client.name})
|
-- naughty.notify({text=current_client.name})
|
||||||
-- naughty.notify({text=focused_client.name})
|
-- naughty.notify({text=focused_client.name})
|
||||||
|
-- naughty.notify({text=inspect(c:geometry())})
|
||||||
|
-- naughty.notify({text=inspect(mouse.current_widget_geometry)})
|
||||||
|
|
||||||
-- todo: disable mouse movement if unmanage was initiated by mouse click
|
-- todo: disable mouse movement if unmanage was initiated by mouse click
|
||||||
-- it seems the only way to do it externally would be to
|
-- it seems the only way to do it externally would be to
|
||||||
-- 1: get the geometry and location of the client in unmanage state
|
-- 1: get the geometry and location of the client in unmanage state
|
||||||
-- 2: get mouse position
|
-- 2: get mouse position
|
||||||
-- 3: guess the Y area, like top 20 pixels or relative to the client
|
-- 3: guess the Y area, like top 20 pixels or relative to the client
|
||||||
-- 4: assume, it was a mouse click
|
-- 4: assume, it was a mouse click
|
||||||
|
|
||||||
|
-- proximity detection sometimes, it's annoying this thing
|
||||||
|
-- centers while we are super close to the next window we
|
||||||
|
-- should add promixity detection, and if too close to the
|
||||||
|
-- upcoming client, we should let the mouse stay.
|
Loading…
Reference in New Issue