4

I have written a Python application (with pygtk and pymozembed) which I use very often.

In the Unity dash my application has an icon (as I definded in the .desktop file). But when I start it, there is no icon in the launcher. Just an empty hole.

Launcher file: /home/witek/.local/share/applications/kadro-reader.desktop

[Desktop Entry]
Name=Google Reader
Comment=Open site with Kadro: reader -> https://www.google.com/reader/view/
Icon=/home/witek/.kadro/sites/reader/icon.png
Exec=/home/witek/.kadro/sites/reader/start.sh
Categories=Network;
Type=Application

Python code for window initialization:

win = gtk.Window()
win.set_title("Google Reader")
win.set_icon_from_file("/home/witek/.kadro/sites/reader/icon.png")

How to add an Unity launcher icon to my Python application?

4
  • 1
    is your icon a png or svg? Where did you install it? Did you run gtk-update-icon-cache after installing your icon?
    – Timo Kluck
    Dec 6, 2011 at 15:48
  • I have edited my question to add my concrete example.
    – Witek
    Dec 8, 2011 at 14:35
  • Are you making a site-specific browser? Cuz I want that.
    – Ken Kinder
    Feb 16, 2012 at 3:39
  • I use it for sites like Facebook or Google which try to track me. That way I have a specific browser for these sites and my default browser is not logged in into these services. You can download it here: github.com/witek/kadro/downloads
    – Witek
    Feb 21, 2012 at 14:52

2 Answers 2

3
+50

I don't think icon in .desktop file takes full path. I think it takes the name of an icon and searches for that icon in the current icon theme.

Try to put that icon at ~/.icons/google-reader.png and in the .desktop file just put

Icon=google-reader
1

I have got I think a better answer. As the described solution add the icon application to the Dash Unity panel, it fails to display the icon on the application itself in /usr/share/applications.

You only need to add the icon (with the name declared in the Desktop Entry) in the /usr/share/pixmaps/ directory. This is the directory where all applications put their icons. This way you get your icon displaying in Dash Unity and on the application in the applications folder.

Besides the one currently checked is working, it requires you to create a new folder in your Home directory. This is not necessary if you use the /usr/share/pixmaps directory.

1
  • My application creates launchers (by the user) which are user specific. Therefor they have to be in the users home. The user also has no permissions to write into /usr/share/pixmaps.
    – Witek
    Feb 21, 2012 at 14:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .