On 03.11.2011 01:27, Wladyslaw Zbikowski wrote:
> On Tue, Nov 1, 2011 at 6:50 PM, Anurag Priyam <[email protected]> 
> wrote:
>> Does `property::icon`[1] signal work?
>>
>> [1]: https://awesome.naquadah.org/wiki/Signals#client
> 
> Unfortunately not - two problems I run into intercepting the icon signal:
> 
> 1. Whatever causes the Emacs and Acrobat icons to change, does not
> emit the signal
> 
> 2. Setting the icon from within the icon change handler causes
> infinite recursion
> 
> client.connect_signal("property::icon_name", function (c)
>                                            if c.class == "Emacs" then
>                                               print("Emacs icon just changed")
>                                               if c.icon ~= gnuimg then
>                                                  c.icon = gnuimg
>                                                  print("You won't get here 
> til you hit a stack overflow")
>                                               end
>                                            end
> end)

Uhm, your two points don't make sense. If it doesnt work, how can it cause
infinite recursion?

Anyway:

local recursion = false
client.connect_signal("property::icon",
  -- Why were you using icon_name? That is the name when the client is iconified
  -- aka minimized
  function(c)
    if recursion then return end
    recursion = true
    c.icon = gnuimg
    -- I don't think your "icon ~= gnuimg" check does what you want.
    -- It checks if it is the same image, not if the two images have the
    -- same content
    recursion = false
end)

-- 
Q: Because it reverses the logical flow of conversation.
A: Why is putting a reply at the top of the message frowned upon?

-- 
To unsubscribe, send mail to [email protected].

Reply via email to