From d9a82c87a4ccc70a3fa222e2456fbf467bd40f5b Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Tue, 15 Apr 2014 22:55:23 -0400 Subject: [PATCH] Support multiple tags at once in the tasklist --- impl/taglist/init.lua | 5 ++--- impl/tasklist/init.lua | 14 ++++++++++---- layout/vertical.lua | 1 - 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/impl/taglist/init.lua b/impl/taglist/init.lua index 6da1627..bb6f9db 100644 --- a/impl/taglist/init.lua +++ b/impl/taglist/init.lua @@ -95,7 +95,6 @@ local function create_item(t,s) end) item._internal.screen = s --- item.state[radical.base.item_flags.USED ] = #t:clients() > 0 item.state[radical.base.item_flags.SELECTED] = t.selected or nil cache[t] = item item.tag = t @@ -106,8 +105,8 @@ local function track_used(c,t) if t then local item = cache[t] or create_item(t,tag.getscreen(t)) if not item then return end -- Yes, it happen if the screen is still nil - item.state[radical.base.item_flags.USED] = #t:clients() > 0 - item.state[radical.base.item_flags.CHANGED] = not t.selected + item.state[radical.base.item_flags.USED] = #t:clients() > 0 and true or nil + item.state[radical.base.item_flags.CHANGED] = ((not t.selected) and #t:clients() > 0) and true or nil end end diff --git a/impl/tasklist/init.lua b/impl/tasklist/init.lua index 2c47987..87f80a4 100644 --- a/impl/tasklist/init.lua +++ b/impl/tasklist/init.lua @@ -167,11 +167,17 @@ local function load_clients(t) local screen = tag.getscreen(t) if not t or not screen or not instances[screen] then return end local menu = instances[screen].menu - if t.selected then + local clients = {} + local selected = tag.selectedlist(screen) + -- The "#selected > 0" is for reseting when multiple tags are selected + if t.selected or #selected > 0 then menu:clear() - for k, c in ipairs(t:clients()) do - if not c.sticky then - add_client(c,screen) + for k2,t2 in ipairs(selected) do + for k, c in ipairs(t2:clients()) do + if not c.sticky then + add_client(c,screen) + clients[#clients+1] = c + end end end for c,_ in pairs(sticky) do diff --git a/layout/vertical.lua b/layout/vertical.lua index abccf4e..ae6e937 100644 --- a/layout/vertical.lua +++ b/layout/vertical.lua @@ -112,7 +112,6 @@ function module:setup_item(data,item,args) end --Create the background local item_layout = item.layout or data.item_layout or horizontal_item_layout - print("\n\n\n\nsadHERE",item.layout,data.item_layout) item.widget = item_layout(item,data,args)--wibox.widget.background() cache_pixmap(item)