How to add an icon to apps in Ubuntus’ Application-menu that only show a generic icon

Sponsored Link
Have you ever installed an application "manually" (not via Synaptic or Update-Manager, but by compiling it yourself and using some kind of installer-script for example)? And were you annoyed that only a generic icon was shown in Ubuntus' Applications-menu? If so, this tip is for you.

I will take the application named "RSSOwl" as an example.

The first thing we have to do is to open this folder:

~/.local/share/applications

Here we find a lot of files and some with a name ending with ".desktop". These are textfiles and therefore can be opened via any texteditor (like gedit). But when we do a doubleclick, the appliction representing the file (in this case RSSOwl) will be opened, so we have to open the file by dragging it onto an opened gedit-window (actually, this was the only way I was able to open it, as this file wasn't shown in gedits' file-requester. The problem that came up with this solution was that gedit showed that files' name as "alacarte-made-3.desktop". I can't say why this happened and the edited file got saved with the original filename as well (when I went on editing) a backup-file with that strange filename was saved.

When we open the file named "RSSOwl" with gedit, we see this: (username is replaced with ###):

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=gnome-panel-launcher
Name[en_US]=rssOwl
Exec=/home/###/apps/rssowl/RSSOwl
Name=rssOwl
Icon=gnome-panel-launcher

The interesting parts are the lines starting with "Icon". There are two, the first being language-specific, the other being generic. These lines have to be edited like described below. But for that we first have to find an appropriate icon. And a good place to find one is the path that is found in the line starting with "Exec=". If we look into that folder, we will find a file named "icon.xpm".

To actually use that icon, we have to replace this line:

Icon[en_US]=gnome-panel-launcher

with this (### should be replaced with your username):

Icon[en_US]=/home/###/apps/rssowl/icon.xpm

We have to do this with all lines starting with "Icon". To be 100% correct, it would probably be sufficient, if we would only change the line starting with "Icon[en_US]=", if we would only use one language all the time. But if we change all the lines, we can be sure that the same icon is used, regardless which language is activated in Ubuntu.

Anyhow, after saving this file, we should see the appropriate icon for "RSSOwl" within Ubuntus' "Applications/Programming"-submenu

Sponsored Link

Incoming search terms:

Related posts

3 thoughts on “How to add an icon to apps in Ubuntus’ Application-menu that only show a generic icon

  1. Or you can change the icon graphically using System -> Preferences -> Main Menu. When you open up the Properties for a menu item, click the icon there and it will popup a file browser to select the new icon.

    [Reply]

    Greenie Reply:

    Heh, I didn’t know that, but thanks for the tip. I guess this may be another case of “useful, but not very obvious”. I’ve been searching quite a while on the net on how to change the icon, but didn’t find anything. Though I agree, doing it graphically is certainly far easier. Though I still don’t mind working on configuration-files, as it gives one more insight on how things work underneath the graphical-system.

    [Reply]

  2. @Greenie: But editing .desktop files is not really the most interesting stuff you can do under the hood. ;)

    [Reply]

Leave a comment

Your email address will not be published. Required fields are marked *