From a44439a6c0fa1677801adf764be8afc28d78c4e5 Mon Sep 17 00:00:00 2001 From: Danny Navarro Date: Sun, 17 Oct 2010 15:35:50 +0200 Subject: [PATCH] Add awful.widget.tasklist.filter.minimizedcurrenttags Added function to show only minimized clients in the taskbar for the current tag. Signed-off-by: Danny Navarro Signed-off-by: Uli Schlachter --- lib/awful/widget/tasklist.lua.in | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/awful/widget/tasklist.lua.in b/lib/awful/widget/tasklist.lua.in index 49813ceee..82ca88217 100644 --- a/lib/awful/widget/tasklist.lua.in +++ b/lib/awful/widget/tasklist.lua.in @@ -159,6 +159,32 @@ function filter.currenttags(c, screen) return false end +--- Filtering function to include only the minimized clients from currently selected tags. +-- @param c The client. +-- @param screen The screen we are drawing on. +-- @return true if c is in a selected tag on screen and is minimized, false otherwise +function filter.minimizedcurrenttags(c, screen) + -- Only print client on the same screen as this widget + if c.screen ~= screen then return false end + -- Include sticky client + if c.sticky then return true end + -- Check client is minimized + if not c.minimized then return false end + tags = capi.screen[screen]:tags() + for k, t in ipairs(tags) do + -- Select only minimized clients + if t.selected then + local ctags = c:tags() + for _, v in ipairs(ctags) do + if v == t then + return true + end + end + end + end + return false +end + --- Filtering function to include only the currently focused client. -- @param c The client. -- @param screen The screen we are drawing on.