From d2988d1aab78bc5ff338b5a8409a9062baa89110 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 28 Aug 2016 16:35:47 -0400 Subject: [PATCH] tag: Fix index when screen count change. There was still a problem that caused the "old" tags to be inserted in the wrong position when "saved" from a screen being removed. Also, this use a :get_tags(true) to save an uneeded sorting pass. --- lib/awful/tag.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/awful/tag.lua b/lib/awful/tag.lua index 7be30a82d..b65c3f41e 100644 --- a/lib/awful/tag.lua +++ b/lib/awful/tag.lua @@ -465,6 +465,7 @@ function tag.object.set_screen(t, s) -- Change the screen tag.setproperty(t, "screen", s) + tag.setproperty(t, "index", #s:get_tags(true)) -- Make sure the client's screen matches its tags for _,c in ipairs(t:clients()) do @@ -473,10 +474,8 @@ function tag.object.set_screen(t, s) end -- Update all indexes - for _,screen in ipairs {old_screen, s} do - for i,t2 in ipairs(screen.tags) do - tag.setproperty(t2, "index", i) - end + for i,t2 in ipairs(old_screen.tags) do + tag.setproperty(t2, "index", i) end -- Restore the old screen history if the tag was selected