From ecb870fd48b8dde69af8e8e3db2c165636cd8273 Mon Sep 17 00:00:00 2001 From: Yessiest Date: Sat, 11 Mar 2023 13:09:55 +0400 Subject: [PATCH] Try and focus no matter what --- modules/desktop.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/desktop.lua b/modules/desktop.lua index 4ff00b0..1a84f34 100644 --- a/modules/desktop.lua +++ b/modules/desktop.lua @@ -232,7 +232,8 @@ client.connect_signal("manage",function(c) end end) end --}}} --- Find a client to focus on + +-- Find a client to focus on when switching tags for s in screen do for _,t in pairs(awful.tag.gettags(s)) do t:connect_signal("property::selected", function(t) @@ -245,3 +246,13 @@ for s in screen do end) end end +-- Focus on the previous client once the newer client is closed +client.connect_signal("unmanage",function(c) + local focused_clients = screen.primary.clients + local prev + for _,v in pairs(focused_clients) do + if v == c then break end + prev = v + end + client.focus = prev +end)