unmanage logic updated
This commit is contained in:
		
							
								
								
									
										39
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								init.lua
									
									
									
									
									
								
							| @@ -5,7 +5,7 @@ local inspect = require('inspect') | |||||||
|  |  | ||||||
| -----------------------------------------------------------------> locals -- ; | -----------------------------------------------------------------> locals -- ; | ||||||
|  |  | ||||||
| local stay_classes = {  | local stay_classes = { | ||||||
|     awesome |     awesome | ||||||
|     -- taskbar |     -- taskbar | ||||||
| } | } | ||||||
| @@ -18,14 +18,14 @@ local function set_contains(set, key) | |||||||
|     return set[key] ~= nil |     return set[key] ~= nil | ||||||
| end | end | ||||||
|  |  | ||||||
| local micky = 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({  |         mouse.coords({ | ||||||
|             x = cgeometry.x + cgeometry.width / 2, |             x = cgeometry.x + cgeometry.width / 2, | ||||||
|             y = cgeometry.y + cgeometry.height / 2  |             y = cgeometry.y + cgeometry.height / 2 | ||||||
|         }) |         }) | ||||||
|     end) |     end) | ||||||
| end | end | ||||||
| @@ -44,10 +44,7 @@ client.connect_signal("focus", function(c) | |||||||
|         local should_stay = set_contains(stay_classes, client_under_mouse.class) |         local should_stay = set_contains(stay_classes, client_under_mouse.class) | ||||||
|  |  | ||||||
|         if should_stay then return false end |         if should_stay then return false end | ||||||
|         --+ exclusions  |         --+ exclusions | ||||||
|  |  | ||||||
|         -- if compare_coords(focused_client) then return false end |  | ||||||
|         --+ avoid tabs |  | ||||||
|  |  | ||||||
|         if not client_under_mouse then |         if not client_under_mouse then | ||||||
|             micky() |             micky() | ||||||
| @@ -56,10 +53,10 @@ client.connect_signal("focus", function(c) | |||||||
|         --+ nothing under the mouse, move directly |         --+ nothing under the mouse, move directly | ||||||
|  |  | ||||||
|         if focused_client:geometry().x ~= client_under_mouse:geometry().x |         if focused_client:geometry().x ~= client_under_mouse:geometry().x | ||||||
|            or focused_client:geometry().y ~= client_under_mouse:geometry().y |             or focused_client:geometry().y ~= client_under_mouse:geometry().y | ||||||
|            then |         then | ||||||
|            micky() |             micky() | ||||||
|            return false |             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. | ||||||
| @@ -68,17 +65,19 @@ client.connect_signal("focus", function(c) | |||||||
|     --> client without the callback. |     --> client without the callback. | ||||||
| end) | 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 | ||||||
|  |  | ||||||
|     if not client_under_mouse then  |     local killed_client = c | ||||||
|  |     --+ client the focus is going towards | ||||||
|  |  | ||||||
|  |     if not client_under_mouse then | ||||||
|         return false |         return false | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     if client_under_mouse ~= c then |     if client_under_mouse ~= c then | ||||||
|         micky() |         micky() | ||||||
|     end  |     end | ||||||
|     --+ no need for the callback here. |     --+ no need for the callback here. | ||||||
| end) | end) | ||||||
|  |  | ||||||
| @@ -90,9 +89,9 @@ return micky | |||||||
| --> 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')) | ||||||
| --   mouser()  | --   mouser() | ||||||
| -- 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}) | ||||||
| @@ -109,4 +108,4 @@ return micky | |||||||
| -- proximity detection sometimes, it's annoying this thing | -- proximity detection sometimes, it's annoying this thing | ||||||
| -- centers while we are super close to the next window we | -- centers while we are super close to the next window we | ||||||
| -- should add promixity detection, and if too close to the | -- should add promixity detection, and if too close to the | ||||||
| -- upcoming client, we should let the mouse stay. | -- upcoming client, we should let the mouse stay. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user