awful.autofocus: improve client focus with multiple screens

Changing screen focus to an empty tag leaves focus on a client on the
previous screen, if a tag with clients is focused next the focus
remains on the previous screen. Now awful.autofocus compares the tag
screen and clients screen to learn if the focus should be given to a
client on the focused screen. Client that gets the focus is selected
from history, as usual.

Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Adrian C. (anrxc) 2010-01-09 17:23:05 +01:00 committed by Julien Danjou
parent a757ddabc4
commit dfd6060a53
1 changed files with 3 additions and 0 deletions

View File

@ -19,6 +19,9 @@ local function check_focus(obj)
if not client.focus or not client.focus:isvisible() then
local c = aclient.focus.history.get(obj.screen, 0)
if c then client.focus = c end
elseif client.focus and client.focus.screen ~= obj.screen then
local c = aclient.focus.history.get(obj.screen, 0)
if c then client.focus = c end
end
end