awful.autofocus: Skip invalid screens

This code uses delayed calls to lazily update things. Thanks to this, it can try
to update a screen long after it was removed. Fix this by just doing nothing on
invalid screens.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-05-01 19:44:17 +02:00
parent bc9b3ca751
commit b0038c8ddb
1 changed files with 2 additions and 1 deletions

View File

@ -18,6 +18,7 @@ local timer = require("gears.timer")
--
-- @param obj An object that should have a .screen property.
local function check_focus(obj)
if not obj.screen.valid then return end
-- When no visible client has the focus...
if not client.focus or not client.focus:isvisible() then
local c = aclient.focus.history.get(screen[obj.screen], 0, aclient.focus.filter)
@ -39,7 +40,7 @@ end
-- @param tag A tag object
local function check_focus_tag(t)
local s = t.screen
if not s then return end
if (not s) or (not s.valid) then return end
s = screen[s]
check_focus({ screen = s })
if client.focus and screen[client.focus.screen] ~= s then