Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Will Unity allow making custom launcher icons from .desktop files or via menu editing system? (Right now the launcher doesn't give the option to "keep in launcher" on all programs.

For some programs I use, I have to make custom launchers or .desktop files.

For instance, daily blender builds are generally just folders with an executable.

In basic Gnome or KDE, I can make a new menu entry with the menu editing system. Then, I can also add it to Docky either from the menu or by dragging a .desktop file to it. Unity launcher doesn't support drag and drop, so thats not a bug or anything, but when I open a .desktop file, it has unpredictable results. Most time it will not have "keep in launcher". Sometime it will have a pinnable item without the .desktop's icon, and if I pin the item to the launcher, it will not call upon the program again after closing it. I've also gotten it to just work with a .desktop file for celtx.

share|improve this question
2  
If your Ubuntu has non-English locale, the custom icon may not work in the Unity Dash (but it works perfectly on the Desktop). Before drag-n-drop to the Unity Dash, edit your desktop file (e.g. with gedit) and remove the row with localized icon, in my case Icon[sv_SE]=gnome-panel-launcher and leave the other "Icon=" row. –  Anatoly Mironov Jun 5 '11 at 20:50

15 Answers 15

up vote 99 down vote accepted

For 11.04 and earlier:

Unity does support custom launchers from .desktop files. To create custom launcher from a .desktop file you need to create a *.desktop file for your program.

gedit ~/.local/share/applications/name.desktop

The .desktop file should look something like this:

[Desktop Entry]
Name=the name you want shown
Comment=
Exec=command to run
Icon=icon name
Terminal=false
Type=Application
StartupNotify=true

In your file manager open your home folder and navigate to: (You may need to press ctrl+h to show hidden files to see the .gconf directory.)

.gconf-> desktop-> unity-> launcher -> favourites

you'll see a bunch of folders starting with "app-". you need to create a folder for your program. Use the same name.desktop you used in /usr/share/applications. Go into 1 of the folders for something that is already on the dock & copy the xml file and paste that into your new folder. Open it with your text editor and change the name of the *.desktop to your name.desktop.

Open gconf-editor (you can open gconf by running the command gconf-editor in the Terminal) & go to:

desktop-> unity-> launcher -> favorites

Double click the list on the right & add your name.desktop.

Log out & back in and you should see your launcher. (thank you kerry_s on the Ubuntu Forums for helping with this answer)

Unity also has a feature called Lenses. By default, you have two in Unity: Applications and Files. In the future, you will be able to install and create a lot more. There is some info about that on the Ubuntu wiki: https://wiki.ubuntu.com/Unity/Lenses

share|improve this answer
13  
There no longer appears (in 11.04) to be the path "desktop-> unity-> launcher -> favorites" in the gconf-editor. –  krumpelstiltskin May 2 '11 at 21:42
2  
The answer below from Bazon has a way that works for 11.04 and is way easier. –  Lode Aug 1 '11 at 9:40
2  
This doesn't seem to work any more on 14.04 –  rubo77 Jun 20 at 15:14
up vote 105 down vote
+250

UPDATED: 2014-Nov

For Ubuntu 14.10

still to test ..


For Ubuntu 14.04 LTS (11.10 or later), with Unity (3D)

NOTE: This can replace the function of an existing icon, or (once created) can be searched for (from Dash icon) to add to current button-bar.

First make your OWN copy of any of the .desktop files you want to modify. It is MUCH safer, and then you can always delete and start over.

(list all files)

ls /usr/share/applications/*.desktop

Example: Mozilla Firefox, firefox.desktop

(do this once, or after deleting any failed attempt)

cp /usr/share/applications/firefox.desktop ~/.local/share/applications

Then carefully change any wording, or add additional options.

(edit the file)

gedit ~/.local/share/applications/firefox.desktop &

Note: The ampersand '&' releases the command line immediately.


My own 'firefox.desktop' file:

Mozilla Firefox

[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
Name[es]=Navegador web Firefox
Name[fr]=Navigateur Web Firefox
Name[it]=Firefox Browser Web
Comment=Browse the World Wide Web
Comment[de]=Im Internet surfen
Comment[es]=Navegue por la web
Comment[fr]=Naviguer sur le Web
Comment[it]=Esplora il web
GenericName=Web Browser
GenericName[es]=Navegador web
GenericName[fr]=Navigateur Web
GenericName[it]=Browser web
Exec=firefox %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-    handler/chrome;video/webm;
StartupWMClass=Firefox
StartupNotify=true

X-Ayatana-Desktop-Shortcuts=NewWindow;Private;Safe;ProfileManager;

[NewWindow Shortcut Group]
Name=Open a New Window
Name[de]=Ein neues Fenster öffnen
Name[es]=Abrir una ventana nueva
Name[fr]=Ouvrir une nouvelle fenêtre
Name[it]=Apri una nuova finestra
Exec=firefox -new-window
TargetEnvironment=Unity

[Private Shortcut Group]
Name=Private Mode
Exec=firefox -private-toggle
TargetEnvironment=Unity

[Safe Shortcut Group]
Name=Safe Mode
Exec=firefox -safe-mode
TargetEnvironment=Unity

[ProfileManager Shortcut Group]
Name=Profile Manager
Exec=firefox -ProfileManager
TargetEnvironment=Unity

My own 'libreoffice-startcenter.desktop' file:

LibreOffice

[Desktop Entry]
Version=1.0
Terminal=false
Icon=libreoffice-main
Type=Application
Categories=Office;
Exec=libreoffice %U
# MimeType=application/vnd.openofficeorg.extension;
MimeType=application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-template;application/vnd.oasis.opendocument.text-web;application/vnd.oasis.opendocument.text-master;application/vnd.sun.xml.writer;application/vnd.sun.xml.writer.template;application/vnd.sun.xml.writer.global;application/vnd.stardivision.writer;application/msword;application/vnd.ms-word;application/x-doc;application/rtf;text/rtf;application/vnd.wordperfect;application/wordperfect;application/vnd.openxmlformats-officedocument.wordprocessingml.document;application/vnd.ms-word.document.macroenabled.12;application/vnd.openxmlformats-officedocument.wordprocessingml.template;application/vnd.ms-word.template.macroenabled.12;application/vnd.oasis.opendocument.spreadsheet;application/vnd.oasis.opendocument.spreadsheet-template;application/vnd.sun.xml.calc;application/vnd.sun.xml.calc.template;application/vnd.stardivision.calc;application/vnd.stardivision.chart;application/msexcel;application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;application/vnd.ms-excel.sheet.macroenabled.12;application/vnd.openxmlformats-officedocument.spreadsheetml.template;application/vnd.ms-excel.template.macroenabled.12;application/vnd.ms-excel.sheet.binary.macroenabled.12;text/csv;application/x-dbf;application/vnd.oasis.opendocument.graphics;application/vnd.oasis.opendocument.graphics-template;application/vnd.sun.xml.draw;application/vnd.sun.xml.draw.template;application/vnd.stardivision.draw;application/vnd.oasis.opendocument.presentation;application/vnd.oasis.opendocument.presentation-template;application/vnd.sun.xml.impress;application/vnd.sun.xml.impress.template;application/vnd.stardivision.impress;application/mspowerpoint;application/vnd.ms-powerpoint;application/vnd.openxmlformats-officedocument.presentationml.presentation;application/vnd.ms-powerpoint.presentation.macroenabled.12;application/vnd.openxmlformats-officedocument.presentationml.template;application/vnd.ms-powerpoint.template.macroenabled.12;application/vnd.oasis.opendocument.formula;application/vnd.sun.xml.math;application/vnd.stardivision.math;

Name=LibreOffice 
Name[pt_BR]=BrOffice 
GenericName=Office 
GenericName[de]=Büroanwendungen
GenericName[en]=Office
GenericName[es]=Oficina
GenericName[fr]=Bureautique
GenericName[it]=Office
Comment=The office productivity suite compatible to the open and standardized ODF document format. Supported by The Document Foundation.
Comment[de]=Die zum offenen und standardisierten ODF-Format kompatible Sammlung von Büroanwendungen. Unterstützt durch »The Document Foundation«.
Comment[en]=The office productivity suite compatible to the open and standardized ODF document format. Supported by The Document Foundation.
Comment[es]=Suite de productividad para la oficina compatible con ODF, el formato de documentos abierto y estandarizado. Con el soporte de la Document Foundation.
Comment[fr]=Suite bureautique compatible avec le format de document standard et ouvert ODF. Soutenue par The Document Foundation.
Comment[it]=La suite di produttività compatibile con il formato standard e aperto dei documenti ODF. Supportata dalla The Document Foundation.

X-Ayatana-Desktop-Shortcuts=Writer;Calc;Draw;Impress;Math;

[Writer Shortcut Group]
Name=Writer
Exec=libreoffice --writer %U
TargetEnvironment=Unity

[Calc Shortcut Group]
Name=Calc
Exec=libreoffice -calc %U
TargetEnvironment=Unity

[Draw Shortcut Group]
Name=Draw
Exec=libreoffice -draw %U
TargetEnvironment=Unity

[Impress Shortcut Group]
Name=Impress
Exec=libreoffice -impress %U
TargetEnvironment=Unity

[Math Shortcut Group]
Name=Math
Exec=libreoffice -math %U
TargetEnvironment=Unity

A multi-tool icon 'toolbox.desktop' file:

[Desktop Entry]
Name=Ubuntu Toolbox
Comment=System Settings
Exec=unity-control-center --overview
Icon=redhat-tools
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;System;
OnlyShowIn=Unity;
Keywords=Preferences;Settings;
X-Ubuntu-Gettext-Domain=unity-control-center

X-Ayatana-Desktop-Shortcuts=GnomeTerminal;SoftwareCenter;SoftwareUpdates;

[GnomeTerminal Shortcut Group]
Name=Gnome Terminal
Exec=gnome-terminal
TargetEnvironment=Unity

[SoftwareCenter Shortcut Group]
Name=Ubuntu Software Center
Exec=software-center
TargetEnvironment=Unity

[SoftwareUpdates Shortcut Group]
Name=Update Manager  
Exec=update-manager -c  
TargetEnvironment=Unity

Here are some of my earlier efforts.

Files

Mozilla Thunderbird

share|improve this answer
9  
+1 for Very Informative answer –  Hashken Jul 18 '12 at 12:42
    
What if there are no .desktop files? That's the case fot Sublime Text 2, for example. –  That Brazilian Guy Sep 29 '13 at 4:46
1  
Once you've copied and made the change, how do you actually get the new icon into the dash sidebar? –  Cory Jun 26 at 19:55
1  
Just drag from ~/.local/share/applications to dash sidebar. Open 'Nautilus/Files'; View > Show Hidden Files; navigate from '.local' > '.local/share' > ''.local/share/applications'; drag .desktop file .. –  david6 Jun 27 at 8:06

ubuntu 14.04 +

once you have created the above mentioned file in /usr/share/applications/

cd /usr/share/applications
nautilus .
double click your new application icon and get it launched
once launched right click to lock to launcher

this is more fool proof than trying to drag and drop same app icon onto launcher bar

share|improve this answer

For 11.10 and newer:

You can still create the Launcher on the Desktop by using the old GUI dialog.

Using ALT+F2 type:

gnome-desktop-item-edit --create-new ~/Desktop (Capital D)

This will start the dialog( Create launcher):

enter image description here

You can put this .desktop file in any folder, and then drag and drop to the launcher.

Note: The package gnome-desktop-item-edit must be installed first, so if you have gnome-panel installed, then it is installed automatically.

share|improve this answer
3  
Thank you very much, worked like a charm. –  Martin Klinke Jan 28 '12 at 12:41
2  
Thanks THIS is the solution I was looking for. The option should again be added in Ubuntu since this affects things from Wine apps in the Desktop, to customized scripts and programs that need parameters. –  Luis Alvarado Apr 25 '12 at 20:02
4  
doesnt work for 12.04 –  Ubuntuser Sep 9 '12 at 14:11
2  
This is simply amazing. –  Karel Bílek Jan 28 '13 at 6:56
4  
I had to sudo apt-get install gnome-panel first. –  wberry May 8 '13 at 14:59

For unity launcher of Ubuntu 12.04, the official documentation 'UnityLaunchersAndDesktopFiles' has explained quite well.

The youtube video is more intuitive. Just follow the video tutorial and it helps a lot.

share|improve this answer

For me in 12.04 I do the following:

  1. in the Desktop create an "Untitled Document". Just right click in the Desktop and select Create New Document.

  2. Edit the file with Gedit and add the following lines:

[Desktop Entry]
Type=Application

Save the file and THEN rename it to whatever you want but at the end of the name add .desktop. For example if I wanted to make a shortcut for a wine program like photoshop I would put as a name photoshop.desktop

Now you should be able to right click the file and the Launcher Properties should appear like this example:

enter image description here

As you can see in the image now you can put whatever you want in the command line, another name, an icon for it, etc..

Don't forget to set Permissions as executable! Otherwise it will not work.

It is like the short version of other answers here.

share|improve this answer

12.04

For those who like having a GUI: In 12.04 you also have the option of using Arronax which is a Nautilus plugin to create your launcher (.desktop files to be more accurate), heres an explanation of how it works.

If you already have the application launcher you can simply right click and click on the "Create starter for this file" option as shown below.

enter image description here

If you have desktop icons enabled you can create your own launcher with specific commands by simply right clicking on your desktop, this will give you the following option to create a blank starter:

enter image description here

Once you have clicked on "Create Starter" you will have the following dialogue box open where you can easily customize your starter with whatever command you'd like:

enter image description here

Once you've saved your launcher to your desktop you will see a file as shown here:

enter image description here

You then simply pick it up and drag it onto your dock in whatever place you like: enter image description here

A couple of nice features:

  • Being able to assign Keywords to the command so it becomes searchable through the unity dash.

  • Relatively quick to create launchers for Windows programs in Wine as explained by this youtube video (haven't tested this out myself though)

Installation

Disclaimer prior to installing: Arronax is still in an Alpha stage of development due to there not being that many programmers working on it, I haven't had a single issue with it but I prefer giving you a heads up in case this affects your choice on installing another PPA you don't know.

To install using the terminal window (Ctrl+Alt+T to open it) type in the following commands:

sudo add-apt-repository ppa:diesch/testing
sudo apt-get update
sudo apt-get install arronax

After doing this you will have to restart Nautilus either by logging in and out, or by typing the following in the terminal window:

nautilus -q

11.10

I intended for this to be an edit to Bart van Heukeloms answer as it also works for 11.10, but as a moderator kindly pointed out when I suggested the edit, it is a different answer, despite being one that works too. I tried this a few times on 11.10 before I upgraded and didn't have any issues. However I cannot vouch that it still works perfectly although I expect it should still work.

Installation in 11.10 is exactly the same as in 12.04.

Note: This quick tutorial is shamelessly inspired/plagiarised from Meilins post on the Ubuntuguide website so he is due all the credit.

share|improve this answer

To add apps to launcher in unity:

  1. Click the dash (ubuntu logo , top left)
  2. Open the app you want to add.
  3. An icon will appear in the launcher, right click the icon, and click Pin to launcher.
  4. To remove an app from the launcher right click the launcher icon and Quit

NOTE : Icons at this point can not be rearranged once loaded, you
must place them in the order you want them to appear when installing the icons in the launcher!

share|improve this answer
    
Hadn't come up with this. Thanks. –  Exeleration-G Jun 24 '11 at 21:18
1  
This doesn't work for all applications, particularly those that you install from source. I've tried pinning Netbeans 7.0 to the Unity bar in every way possible, before making my own .desktop file. –  b. e. hollenbeck Sep 20 '11 at 17:57
    
Icons can be rearranged by clicking and holding the icon for few seconds. –  andho Oct 17 '11 at 10:22

For 11.10 and newer:

In Ubuntu 11.10 the easiest way create custom launcher from a .desktop file is either by copying an existing .desktop file or by creating your custom one.

To create a simple custom one you will need to add these entries to a .desktop file of your choice in ~/.local/share/applications/

nano ~/.local/share/applications/your_application_name.desktop

[Desktop Entry]
Name=the name you want shown
Comment=
Exec=command to run
Icon=icon name
Terminal=false
Type=Application
StartupNotify=true

For extra options for your .desktop file you can visit this site. All the options available are very well described there.

You can also copy a existing application's .desktop file from /usr/share/applications/ to your ~/.local/share/applications/ and edit it to fit your needs.

ie: this will copy gedit .desktop file to the folder where the .desktop files should be saved for a user

cd ~/.local/share/applications
sudo cp /usr/share/applications/gedit.desktop .

After that open that location using nautilus ~/.local/share/applications/ and drag n drop the file you have just created to the Unity launcher.

Has an option instead of drag n dropping the file you can open dconf-editor (install it with sudo apt-get install dconf-tools or look for it in the USC) and navigate to desktop.unity.launcher and edit the key favorites by double clicking on the entries to the right of the key.

To add your custom launcher add it at the position you want with this format '/home/bruno/.local/share/applications/gedit.desktop'. Don't forget to respect the , and the spaces in that line and make sure that the line starts and ends with [ and ] respectively.

With this method you will need to log off and back in for the change in favorites to take effect.

share|improve this answer
    
This is the one that worked for me in Ubuntu 12.04 –  LnxSlck Apr 29 '12 at 16:26
    
even easier - once you copy .desktop file to ~/.local/share/applications/ you can right click on it in nautilus and edit the entries in the GUI. You can also set icon by clicking image, and test launcher by double clicking. Just make sure its +x. –  rynop Apr 30 '12 at 13:40
    
The link to desktop file specification page is very useful. Thanks. –  Andree Dec 6 '12 at 4:14

For 11.04 and earlier:

This is a method without editing config files and without root privileges.

First create the Launcher on the Desktop (only temporary)

  • right click your desktop
  • select Create Launcher...
  • create the custom Launcher as you want to.

Making a Launcher

Now you got the launcher on the Desktop. If you are satisfied with it, get it in the Launcher Panel:

  • Open your Home Folder. Press Ctrl + H to show hidden files if necessary.

  • Browse to .local/share/applications

  • Drag and drop your Launcher from Desktop to that folder.

  • Now drag and drop your launcher from .local/share/applications to the Launcher Bar on the left on your Screen.

  • You can now delete your custom Launcher on the Desktop if it's still there.

That's it.

share|improve this answer
3  
It seems like you don't have to put the launcher in .local/share/applications folder before you drag and drop it on the launcher. You can store it in any folder. –  JannieT May 3 '11 at 20:08
1  
Thanks. That made it easy. Now I have to figure out how to change the icon (emblem?). –  John K May 8 '11 at 7:13
2  
@ John K: In the "creater launcher" dialogue in the beginning you can set an icon by clicking on the default icon in the top left of that window. –  tobi May 13 '11 at 20:35
13  
A regression introduced in 11.10 has removed this method of creating launchers. –  ændrük Sep 26 '11 at 7:19
6  
@aendruk: you can still open the "Create launcher window" with: gnome-desktop-item-edit --create-new <name of the desktop file> –  Pisu Oct 19 '11 at 13:47

I see many complex answers here. This solution is, I think, simple.

  • (First install the package alacarte, if you don't have it. This is the menu editor that was installed by default before 11.10. Obviously you only have to do this once.)
  • Start "Main Menu" by searching for it in the dash.
  • Add an item for your application and close the editor.
  • Start the application by searching for it in the dash.
  • Right-click on the icon and "Keep in launcher"

In Oneiric, you may also need to install the package gnome-panel, which alacarte should, but does not, depend on. See:

https://bugs.launchpad.net/ubuntu/+source/alacarte/+bug/826049

share|improve this answer
    
if your method is used, the application would not fall under any category. –  dumb906 Oct 18 '11 at 0:20
    
@dumb906 What do you mean? You can put the launcher in whatever category in the menu you want. Unless you mean something else by "category"? –  Bart van Heukelom Oct 18 '11 at 9:15
11  
This is by far the simplest solution. –  greggory.hz Oct 25 '11 at 0:08
3  
How on earth does this answer have less up-votes than the others? This is the FASTEST, SIMPLEST, MOST CORRECT answer! –  copolii Nov 24 '11 at 19:43
4  
For Ubuntu this is an usability failure (a lot of other things are great, but here it falls short). The option to add a new application manually should be in the dash menu or in dash / more apps. @copolii this answer has less votes because was given many months after the original question. It works, I've also +1 –  stivlo Nov 26 '11 at 17:03

Use alacarte to create new launchers. Press Alt F2, type "alacarte", hit Enter. Create new launcher there. Now the program will appear in the search results, and you can drag it to the panel.

share|improve this answer
    
alacarte, as good as always. Simple and effective. –  albfan Feb 8 '13 at 0:33

Thank you for the info above. But the paths wasn't correct for my ubuntu 11.04 installation. I found the desktop files in: ~/.gnome2/panel2.d/default/launchers/*.desktop.

In nautilus this folder displayed not the filenames but the names displayed in the unity menu. Right-click and use Properties to see info in the link. It is impossible to see the real file name here however. Use command line

ls ~/.gnome2/panel2.d/default/launchers

to see them.

share|improve this answer
2  
my default launchers bar is empty –  Ubuntuser May 16 '11 at 7:49
    
That was the correct folder for me too! I guess when you upgrade from 11.04 or other older versions. Maybe they could have moved that folder to the new location instead of just creating a new folder... Thank you for adding this comment. –  Alexis Wilke Oct 29 '12 at 1:45

Easy solution:

  1. right click on your Desktop and choose "Create launcher..."
  2. save the launcher
  3. move it to some folder where it won't bother you. (if you delete this file your launcher will be deleted from the dock as well)
  4. drag the launcher to the dock.
share|improve this answer

This is a method without editing config files.

First create the Launcher on the Desktop (only temporary)

  • right click your desktop
  • select Create Launcher...
  • create the custom Launcher as you want to.

Now you got the launcher on the Desktop. If you are satisfied with it, get it in the Launcher Panel:

  • Open Nautilus as root. Press Alt + F2 and Enter gksu nautilus.
  • Browse to /home/your-username/Desktop
  • Copy the launcher by clicking right on it and select Copy.
  • Browse to /usr/share/applications
  • Paste your launcher by clicking right on a blank space and select Paste.
  • Now drag and drop your launcher from /usr/share/applications to the Launcher Bar on the left on your Screen.
  • You can now delete your custom Launcher on the Desktop.

That's it.

share|improve this answer
5  
You can just copy it to ~/.local/share/applications so you don't need to mess with the sudo. –  Jorge Castro Mar 15 '11 at 15:26
    
@Jorge: Yes, that works too. But is browsing to a hidden directory more easy? I'll type this alternative when I got time. –  Bazon Mar 15 '11 at 19:50
    
by the way: Dragging from Desktop to Launcher directly works also, but only if you don't delete the Launcher on the Desktop. –  Bazon Mar 15 '11 at 19:51
1  
a further test showed you can move the launcher from Desktop to anywhere , it's only important that you don't delete the launcher (*.desktop file) afterwards, the symbol in the launcher bar seems to be a link to the other launcher in the file system. –  Bazon Mar 16 '11 at 17:25

protected by Community Oct 5 '11 at 16:42

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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