awful.tag: call property hook on icon changes

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-05-18 16:42:03 +02:00
parent ad44a1d8dc
commit a891ffbe2d
6 changed files with 11 additions and 5 deletions

View File

@ -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

View File

@ -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)

View File

@ -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.

View File

@ -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

View File

@ -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)

View File

@ -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"