On Thu, Nov 3, 2011 at 3:27 AM, Uli Schlachter <[email protected]> wrote:
> Uhm, your two points don't make sense. If it doesnt work, how can it cause
> infinite recursion?

Sorry, my mistake - I didn't realize that c.class could change
depending on how the program was launched, which caused some temporary
confusion. The icon signal is really emitted every time the icon
changes.

> local recursion = false

Thanks, this trick works. I have custom icons working well now without
modifying Awful. The last part was to get per-window icons to be
persistent across restarting Awesome, using a temp file and rule
callback (I hope I am muddying the waters too much with bad practices
;)

# ~/.bashrc
function icon () {
    if ! [ -f "$*" ]; then
        echo $*: no such file
    else
        (
            echo "c=client.focus"
            echo "capi={oocairo=oocairo}"
            echo "c.icon=capi.oocairo.image_surface_create_from_png(\"$*\")"
        ) | awesome-client
        echo $* > /tmp/run/$PPID.icon # make persistent
    fi
}

# ~/.config/awesome/rc.lua

    { rule_any = { class = {"X-terminal-emulator", "Terminator"} },
      callback = function(c)
                    local file = io.open("/tmp/run/" .. c.pid .. ".icon", "r")
                    if file then
                       for line in file:lines() do
                          c.icon = 
capi.oocairo.image_surface_create_from_png(line)
                       end
                       io.close(file)
                    else
                       c.icon =
capi.oocairo.image_surface_create_from_png("/home/jesse/icons/plork.png")
                    end
              end },

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

Reply via email to