1

Ubuntu 12.04, xfce4. I run commands from the command line, not from a launcher. (This shouldn't make a difference, but some replies have assumed I want to click on a launcher and that's not the point.)

What I want: when I run the program /usr/bin/zathura (a PDF viewer), I'd like to see the icon zathura.png appear for each window in the windows menu (the menu triggered by middle-mouse on background, or the one triggered by control-Tab to cycle through windows).

This isn't happening! Instead I'm getting a generic icon.

What I've done:

  • Placed the icon zathura.png in /usr/share/app-install/icons (which already contains the icon okular.png, which shows properly when I run okular).

  • Added the line Icon=zathura to the file /usr/share/applications/zathura.desktop (again in imitation of a similar file, okular.png). NOTE: following Tim's suggest I've replaced the imitative Icon=zathura by a full pathname. The file, in its entirety, is this:

    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=Zathura
    Comment=A minimalistic document viewer
    Exec=zathura %f
    Terminal=false
    Categories=Office;Viewer;
    Icon=/usr/share/app-install/icons/zathura.png
    Keywords=PDF;PS;PostScript;DjVU;document;presentation;
    
  • Restarted the window manager (logged out and back in).

Made not the slightest difference!

I then set out to try to break the okular icon to see if I can find where the icon gets associated to an executable. I can't break it! For instance, if I copy /usr/bin/okular to /usr/bin/fooooo and call that new executable, the window thus created still gets the okular icon, even though there is no fooooo.png or fooooo.desktop, or any .desktop with Name=fooooo or Exec=fooooo.

Where is the association between the executable and the icon made?


NOTE: The point is not for the icon to appear on the desktop. It makes no difference to me whether it appears there or not.
(My desktop shows the contents of my home directory.)

4
  • The .desktop file can go anywhere. For it to show in search, put it in /usr/share/applications. askubuntu.com/questions/281293/… – Tim Aug 27 '14 at 9:49
  • Thanks, but this isn't quite what I want and it isn't working; I've rewritten the question to clarify. – Silvio Levy Aug 29 '14 at 7:24
  • I think you need to give the absolute path to the image, so your icon line is Icon=/usr/share/app-install/icons/zathura.png – Tim Aug 29 '14 at 7:29
  • Thanks for the loving editing of the code. I tend to forget to do that. – Silvio Levy Aug 29 '14 at 7:39
1

This isn't happening! Instead I'm getting a generic icon.

What I've done:

Placed the icon zathura.png in /usr/share/app-install/icons (which already contains the icon okular.png, which shows properly when I run okular).

That's the right thing to do.

  • Added the line Icon=zathura to the file /usr/share/applications/zathura.desktop (again in imitation of a similar file, okular.png). The file, in its entirety, is this:

    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=Zathura
    Comment=A minimalistic document viewer
    Exec=zathura %f
    Terminal=false
    Categories=Office;Viewer;
    Icon=zathura
    Keywords=PDF;PS;PostScript;DjVU;document;presentation;

This is the problem. I believe that it need as absolute path - or at least a file extension. This is because you don't know where the appplication looks by default. For example, cairo-dock is in /usr/share/cairo-dock. So give it the full path like so.

[Desktop Entry]
Version=1.0
Type=Application
Name=Zathura
Comment=A minimalistic document viewer
Exec=zathura %f
Terminal=false
Categories=Office;Viewer;
Icon=/usr/share/app-install/icons/zartha.png
Keywords=PDF;PS;PostScript;DjVU;document;presentation;

I then set out to try to break the okular icon to see if I can find where the icon gets associated to an executable. I can't break it! For instance, if I copy /usr/bin/okular to /usr/bin/fooooo and call that new executable, the window thus created still gets the okular icon, even though there is no fooooo.png or fooooo.desktop, or any .desktop with Name=fooooo or Exec=fooooo.

That's because the link isn't between the name, or executable name, it is with the icon line. Try deleting that, and it will break.

8
  • Alas, having Icon=<full path> didn't help. – Silvio Levy Aug 29 '14 at 7:41
  • "the link isn't between the name, or executable name, it is with the icon line" -- the icon line where? In okular.desktop? How is the executable (now called fooooo) associated with okular.desktop? – Silvio Levy Aug 29 '14 at 7:42
  • Okay, open up that foo.desktop file with gedit, and look at it. One of the lines will still say Icon=/usr/share/app-install/icons/ocular.png. – Tim Aug 29 '14 at 7:43
  • I think you are a bit confused. From now on, the .desktop is called a launcher, and the exec command that it runs is the command. So the launcher (foo.desktop) is still linked to the command occular [someoptions. – Tim Aug 29 '14 at 7:44
  • I never created a fooooo.desktop -- that's why I'm puzzled. There is only the old okular.desktop, with Icon=okular in it, and somehow the command (now called fooooo) seems to be associated with okular.desktop. – Silvio Levy Aug 29 '14 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.