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.