awful.autofocus: fix multiple screens autofocus

There might be multiple screens with visible windows. When closing the
last window of the current screen, try to focus them as well.

If no window has focus and yet some windows are visible (e.g. on another
screen), awesome misbehaves: it uses sloppy keyboard focus (as is the X11
default), but doesn't refresh their border colors or tasklists etc.

Signed-off-by: Tomi Belan <tomi.belan@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Tomi Belan 2009-11-12 17:13:57 +01:00 committed by Julien Danjou
parent 78541da82a
commit 064f4c92fd
1 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,13 @@ local function check_focus(obj)
local c = aclient.focus.history.get(obj.screen, 0)
if c then client.focus = c end
end
-- If we didn't find a client, try other screens.
if not client.focus or not client.focus:isvisible() then
for i = 1, screen.count() do
local c = aclient.focus.history.get(i, 0)
if c and c:isvisible() then client.focus = c; return end
end
end
end
atag.attached_add_signal(nil, "property::selected", check_focus)