The idea is to allow hiding tags from the taglist. There are two patches:

0001 - handles makes taglist updates ignore tags with skip_taglist set.
0002 - makes viewidx() ignore those tags

Perhaps, in view of patch #2, the property should be called "hide" or
"hidden" instead.

cheers,
koniu
From f725dae5b376ab6c2d6b842891a151138b2650ca Mon Sep 17 00:00:00 2001
From: koniu <[email protected]>
Date: Thu, 28 May 2009 07:15:32 +0100
Subject: [PATCH 1/2] awful.widget.taglist: add support for skip_taskbar property

This allows setting skip_taskbar property for a tag to prevent it from showing in the taglist.

Signed-off-by: koniu <[email protected]>
---
 lib/awful/widget/taglist.lua.in |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/awful/widget/taglist.lua.in b/lib/awful/widget/taglist.lua.in
index fb1eec8..f8777c8 100644
--- a/lib/awful/widget/taglist.lua.in
+++ b/lib/awful/widget/taglist.lua.in
@@ -13,6 +13,7 @@ local type = type
 local setmetatable = setmetatable
 local pairs = pairs
 local ipairs = ipairs
+local table = table
 local hooks = require("awful.hooks")
 local common = require("awful.widget.common")
 local util = require("awful.util")
@@ -26,7 +27,13 @@ label = {}
 
 local function taglist_update (screen, w, label, buttons, data, widgets)
     local tags = capi.screen[screen]:tags()
-    common.list_update(w, buttons, label, data, widgets, tags)
+    local showntags = {}
+    for k, t in ipairs(tags) do
+        if not tag.getproperty(t, "skip_taglist") then
+            table.insert(showntags, t)
+        end
+    end
+    common.list_update(w, buttons, label, data, widgets, showntags)
 end
 
 --- Get the tag object the given widget appears on.
@@ -61,7 +68,8 @@ function new(screen, label, buttons)
     hooks.tagged.register(uc)
     hooks.property.register(function (c, prop)
         if (type(c) == "client" and prop == "urgent")
-            or (type(c) == "tag" and prop == "icon") then
+            or (type(c) == "tag" and
+               (prop == "icon" or prop == "skip_taglist")) then
             u(c.screen)
         end
     end)
-- 
1.6.3.1

From 08a414c9188ae662b4f3807370dba84cd1c18241 Mon Sep 17 00:00:00 2001
From: koniu <[email protected]>
Date: Thu, 28 May 2009 07:24:38 +0100
Subject: [PATCH 2/2] awful.tag: viewidx ignores skip_taglist tags

This prevents viewprev/viewnext from cycling to tags not shown in the taglist

Signed-off-by: koniu <[email protected]>
---
 lib/awful/tag.lua.in |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in
index 367df07..17418f9 100644
--- a/lib/awful/tag.lua.in
+++ b/lib/awful/tag.lua.in
@@ -8,6 +8,7 @@
 local util = require("awful.util")
 local pairs = pairs
 local ipairs = ipairs
+local table = table
 local setmetatable = setmetatable
 local capi =
 {
@@ -190,16 +191,22 @@ function viewnone(screen)
     end
 end
 
---- View a tag by its index.
+--- View a tag by its taglist index.
 -- @param i The relative index to see.
 -- @param screen Optional screen number.
 function viewidx(i, screen)
     local tags = capi.screen[screen or capi.mouse.screen]:tags()
+    local showntags = {}
+    for k, t in ipairs(tags) do
+        if not getproperty(t, "skip_taglist") then
+            table.insert(showntags, t)
+        end
+    end
     local sel = selected(screen)
     viewnone(screen)
-    for k, t in ipairs(tags) do
+    for k, t in ipairs(showntags) do
         if t == sel then
-            tags[util.cycle(#tags, k + i)].selected = true
+            showntags[util.cycle(#showntags, k + i)].selected = true
         end
     end
 end
-- 
1.6.3.1

Reply via email to