Trying to migrate old cairo stuff to lgi.cairo...

  cairo = require("lgi").cairo

1) This is to give mplayer an icon, but it seems to do nothing now
(but no error):

   { rule_any = { class = { "MPlayer" } },
     properties = { icon = cairo.ImageSurface.create_from_png(
                            "/tmp/Applications-mplayer.png") }
   },

2) This should grayscale icons. I used to get the icon by just "c.icon" but
that gives "attempt to index userdata value", so I dug around and found some
methods, but I can't seem to get it right; methods are nil, etc. I think I got
atleast the write_to_png and create_from_png right, but seeing as the above 1)
didn't work, I don't know...

  iconbeingset = false
  client.connect_signal("new",
    function(c)
      c:connect_signal("property::icon",
        function()
          if iconbeingset then return end
            icon = c:client_get_icon()
            if icon then
              icon:write_to_png("/tmp/.awesome-icon-quite.png")
              io.popen("convert -modulate 50,40,100 /tmp/a /tmp/b"):read("*all")
              iconbeingset = true
              c:client_set_icon(cairo.ImageSurface.create_from_png("/tmp/b"))
              iconbeingset = false
            end
        end)
    end)


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

Reply via email to