Adding an icon in Ubuntu's Unity for applications which don't provide one

Occasionally, when you're exploring the truly vast range of offerings in the Ubuntu Software Archives via the wonderful Ubuntu Software Centre (or maybe via "apt-cache search"), you might find a graphical application that doesn't have an icon. If this happens, there are 2 things to do:

  1. Raise a bug on that application to have an icon added.

  2. Add an icon temporarily.
Raising a bug is easy, just type:

$ ubuntu-bug <thing>

Where "<thing>" is either the name of the program you are running, or the package that program lives in.

However, you can also quickly add an icon yourself using this simple technique...

There are 2 steps:

  1. Select your icon
  2. Create a "desktop" file

Icons are installed in the "/usr/share/icons/" directory by default, so have a browse around to see what you like. If you're still struggling to find an appropriate icon, you could add the package wm-icons which adds over 1500 new ones (!):

$ sudo apt-get install wm-icons

Having chosen your icon, all that remains is to create the "desktop" file in a particular directory to have Unity, the awesome Ubuntu graphical interface detect it automatically! What's even better is that once you've created the desktop file, you can even run the application from the command-line to have Unity "do the right thing" (TM) and display the corresponding icon in the launcher.

Let's assume the application is called "foo". Simply create a file called "foo.desktop" in directory "~/.local/share/applications/".

File "foo.desktop" would contain:

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon=/usr/share/icons/wm-icons/48x48-crystalclear/modules.png
Name=foo
Comment=my foo application
Exec=/usr/bin/foo

Notes:

  • The icon I've specified above comes from the "wm-icons" package.
  • You will need to change the "Name", "Comment", and the all-important "Exec" keys (or fields) as appropriate.
  • This technique only works for graphical applications.
  • You may need to restart Unity to see the new icon in the applications Lens ("unity --reset")

For all the gory details of "desktop", or "desktop entry" files as they are technically known, see:


Now, you can just run your application by typing "/usr/bin/foo" (the value you entered for the "Exec" field in the desktop file) and see your chosen icon in the launcher on the left of the screen.

Comments

Popular posts from this blog

Byobu Bling with Unicode Custom Indicators

Procenv 0.46 - now with more platform goodness

Upstart User Sessions in Ubuntu Raring