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:
parent
bc9b3ca751
commit
b0038c8ddb
|
@ -18,6 +18,7 @@ local timer = require("gears.timer")
|
||||||
--
|
--
|
||||||
-- @param obj An object that should have a .screen property.
|
-- @param obj An object that should have a .screen property.
|
||||||
local function check_focus(obj)
|
local function check_focus(obj)
|
||||||
|
if not obj.screen.valid then return end
|
||||||
-- When no visible client has the focus...
|
-- When no visible client has the focus...
|
||||||
if not client.focus or not client.focus:isvisible() then
|
if not client.focus or not client.focus:isvisible() then
|
||||||
local c = aclient.focus.history.get(screen[obj.screen], 0, aclient.focus.filter)
|
local c = aclient.focus.history.get(screen[obj.screen], 0, aclient.focus.filter)
|
||||||
|
@ -39,7 +40,7 @@ end
|
||||||
-- @param tag A tag object
|
-- @param tag A tag object
|
||||||
local function check_focus_tag(t)
|
local function check_focus_tag(t)
|
||||||
local s = t.screen
|
local s = t.screen
|
||||||
if not s then return end
|
if (not s) or (not s.valid) then return end
|
||||||
s = screen[s]
|
s = screen[s]
|
||||||
check_focus({ screen = s })
|
check_focus({ screen = s })
|
||||||
if client.focus and screen[client.focus.screen] ~= s then
|
if client.focus and screen[client.focus.screen] ~= s then
|
||||||
|
|
Loading…
Reference in New Issue