Search code examples
pythoniconspygtkubuntu-10.10blurry

PyGTK Icon Blurry in Ubuntu


When using an SVG file as the icon of a PyGTK window set by the function:

set_icon_from_file("icon.svg"),

the icon appears blurry when viewed from the Alt-Tab view and Unity Launcher Bar in Ubuntu 11.10.


Is there a simple way to prevent the icon from becoming blurred and to maintain its normal quality?


Solution

  • Unity and Gnome3 only display icons in the full resolution if you define them in a suitable .desktop file e.g. in ~/.local/share/applications/ and launch the application with this. There you can supply your SVG file and it will be used in full resolution.

    If you want to make sure the desktop environment finds the correct icon in any way, according to this you should make sure to set the correct WM_CLASS, like gtk.gdk.set_program_class("my_app"). Then call your .desktop file my_app.desktop.

    Oh, and you should call gtk.gdk.set_program_class() before set_icon_from_file(), otherwise you will still have the crappy low-res image. The latter is only required if you also run your app on Windows, which does not know the .desktop file.