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)