On Sat, May 30, 2009 at 16:54, Julien Danjou <[email protected]> wrote:
> But please rename the field to something more talky than skip taglist. :)

Amended patches with property renamed to 'hide'. Is that ok?

k
From 9f3dbf37d57021b204185bf14afc624197eb10d3 Mon Sep 17 00:00:00 2001
From: koniu <[email protected]>
Date: Sat, 30 May 2009 17:09:37 +0100
Subject: [PATCH 1/2] awful.widget.taglist: support for 'hide' property

This allows setting 'hide' 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..00de38c 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, "hide") 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 == "hide")) then
             u(c.screen)
         end
     end)
-- 
1.6.3.1

From acd5aeffc91e8f4cd2b4e92d03470bf46a1ce15a Mon Sep 17 00:00:00 2001
From: koniu <[email protected]>
Date: Sat, 30 May 2009 17:11:07 +0100
Subject: [PATCH 2/2] awful.tag: viewidx ignores hidden 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..04f14fb 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, "hide") 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