From 096114a7efd4a0ac9221c652a4534ead129d1eea Mon Sep 17 00:00:00 2001 From: Yusuke Tsutsumi Date: Fri, 26 Nov 2021 23:32:48 -0800 Subject: [PATCH] fix tags being orphaned by screen disconnect In the case where the primary screen is the one that will be removed, the salvage function will not successfully salvage the shared tag, resulting in being unable to retrieve it in new screens. Introduce additional fallback logic to find a suitable screen to move to when salvaging. --- init.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/init.lua b/init.lua index 6fc87f6..23b8e80 100644 --- a/init.lua +++ b/init.lua @@ -44,6 +44,13 @@ local sharedtags = { local function salvage(tag) -- The screen to move the orphaned tag to. local newscreen = capi.screen.primary + -- the primary screen may be the one that is being + -- removed, so try to find a different screen if possible. + for s in capi.screen do + if s ~= tag.screen then + newscreen = s + end + end -- Make sure the tag isn't selected when moved to the new screen. tag.selected = false