From a891ffbe2d6ce61771b1e317abc176c243fed41f Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 18 May 2009 16:42:03 +0200 Subject: [PATCH] awful.tag: call property hook on icon changes Signed-off-by: Julien Danjou --- lib/awful/client.lua.in | 3 ++- lib/awful/layout/init.lua.in | 3 ++- lib/awful/tag.lua.in | 2 +- lib/awful/titlebar.lua.in | 3 ++- lib/awful/widget/taglist.lua.in | 3 ++- lib/awful/widget/tasklist.lua.in | 2 ++ 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in index 2a297408..a5acf021 100644 --- a/lib/awful/client.lua.in +++ b/lib/awful/client.lua.in @@ -8,6 +8,7 @@ local util = require("awful.util") local tag = require("awful.tag") local pairs = pairs +local type = type local ipairs = ipairs local table = table local math = math @@ -83,7 +84,7 @@ end -- @param c The client object. -- @param prop The property which is updated. function urgent.add(c, prop) - if prop == "urgent" and c.urgent then + if type(c) == "client" and prop == "urgent" and c.urgent then table.insert(data.urgent, c) end end diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in index 85aaa2af..f7300326 100644 --- a/lib/awful/layout/init.lua.in +++ b/lib/awful/layout/init.lua.in @@ -6,6 +6,7 @@ -- Grab environment we need local ipairs = ipairs +local type = type local tag = require("awful.tag") local util = require("awful.util") local suit = require("awful.layout.suit") @@ -83,7 +84,7 @@ end hooks.arrange.register(on_arrange) hooks.property.register(function (c, prop) - if c:isvisible() and prop == "size_hints_honor" then + if type(c) == "client" and c:isvisible() and prop == "size_hints_honor" then on_arrange(c.screen) end end) diff --git a/lib/awful/tag.lua.in b/lib/awful/tag.lua.in index 8eda3d2b..5b13803d 100644 --- a/lib/awful/tag.lua.in +++ b/lib/awful/tag.lua.in @@ -153,7 +153,6 @@ end function seticon(icon, tag) local tag = tag or selected() setproperty(tag, "icon", icon) - capi.hooks.tags()(tag.screen, tag, "modify") end --- Get the tag icon @@ -264,6 +263,7 @@ function setproperty(tag, prop, value) data.tags[tag] = {} end data.tags[tag][prop] = value + hooks.user.call("property", tag, prop) end --- Tag a client with the set of current tags. diff --git a/lib/awful/titlebar.lua.in b/lib/awful/titlebar.lua.in index ba6981ec..f0b7054a 100644 --- a/lib/awful/titlebar.lua.in +++ b/lib/awful/titlebar.lua.in @@ -8,6 +8,7 @@ local math = math local image = image local pairs = pairs +local type = type local setmetatable = setmetatable local capi = { @@ -117,7 +118,7 @@ end -- @param c The client to update. -- @param prop The property name which has changed. function update(c, prop) - if c.titlebar and data[c] then + if type(c) == "client" and c.titlebar and data[c] then local widgets = c.titlebar.widgets if prop == "name" then if widgets.title then diff --git a/lib/awful/widget/taglist.lua.in b/lib/awful/widget/taglist.lua.in index 128784e1..e4a24ae5 100644 --- a/lib/awful/widget/taglist.lua.in +++ b/lib/awful/widget/taglist.lua.in @@ -62,7 +62,8 @@ function new(screen, label, buttons) hooks.tags.register(u) hooks.tagged.register(uc) hooks.property.register(function (c, prop) - if prop == "urgent" then + if (type(c) == "client" and prop == "urgent") + or (type(c) == "tag" and prop == "icon") then u(c.screen) end end) diff --git a/lib/awful/widget/tasklist.lua.in b/lib/awful/widget/tasklist.lua.in index a6070aea..a42cab4e 100644 --- a/lib/awful/widget/tasklist.lua.in +++ b/lib/awful/widget/tasklist.lua.in @@ -9,6 +9,7 @@ local capi = { screen = screen, image = image, client = client } local ipairs = ipairs +local type = type local setmetatable = setmetatable local unpack = unpack local table = table @@ -59,6 +60,7 @@ function new(label, buttons) hooks.focus.register(u) hooks.unfocus.register(u) hooks.property.register(function (c, prop) + if type(c) ~= "client" then return end if prop == "urgent" or prop == "floating" or prop == "maximized_horizontal"