awful.tag: fix call to update_urgent from client_untagged

Ref: #130
This commit is contained in:
Daniel Hahler 2015-02-17 18:38:24 +01:00
parent c9f08fb7f8
commit f05ebc5d98
1 changed files with 5 additions and 6 deletions

View File

@ -633,9 +633,8 @@ capi.client.connect_signal("manage", function(c)
end) end)
-- Keep track of the number of urgent clients. -- Keep track of the number of urgent clients.
local function update_urgent(c,t) local function update_urgent(c, t, modif)
local modif = c.urgent == true and 1 or -1 local count = tag.getproperty(t, "urgent_count") or 0
local count = tag.getproperty(t,"urgent_count") or 0
count = (count + modif) >= 0 and (count + modif) or 0 count = (count + modif) >= 0 and (count + modif) or 0
tag.setproperty(t,"urgent" , count > 0) tag.setproperty(t,"urgent" , count > 0)
tag.setproperty(t,"urgent_count", count ) tag.setproperty(t,"urgent_count", count )
@ -644,21 +643,21 @@ end
-- Update the urgent counter when a client is tagged. -- Update the urgent counter when a client is tagged.
local function client_tagged(c,t) local function client_tagged(c,t)
if c.urgent then if c.urgent then
update_urgent(c,t) update_urgent(c, t, 1)
end end
end end
-- Update the urgent counter when a client is untagged. -- Update the urgent counter when a client is untagged.
local function client_untagged(c,t) local function client_untagged(c,t)
if c.urgent then if c.urgent then
update_urgent(c,t) update_urgent(c, t, -1)
end end
end end
-- Count the urgent clients. -- Count the urgent clients.
local function urgent_callback(c) local function urgent_callback(c)
for k,t in ipairs(c:tags()) do for k,t in ipairs(c:tags()) do
update_urgent(c,t) update_urgent(c, t, c.urgent and 1 or -1)
end end
end end