How can I edit/create new launcher items in Unity by hand?

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.

Asked By: Ike

||

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

Answered By: duanedesign

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!

Answered By: JOHNNYG

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.

Answered By: Bazon

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.

Answered By: Bazon

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.
Answered By: dwaynemac

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.

Answered By: Dag Rende

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.

Answered By: krio

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

Answered By: Bart van Heukelom

Updated: 2015-Dec

For Ubuntu 15.10 or 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
Name[nl]=Firefox webbrowser
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
Comment[nl]=Verken het internet
GenericName=Web Browser
GenericName[es]=Navegador web
GenericName[fr]=Navigateur Web
GenericName[it]=Browser web
GenericName[nl]=Webbrowser
Keywords=Internet;WWW;Browser;Web;Explorer
Keywords[de]=Internet;WWW;Browser;Web;Explorer;Webseite;Site;surfen;online;browsen
Keywords[es]=Explorador;Internet;WWW
Keywords[fr]=Internet;WWW;Browser;Web;Explorer;Fureteur;Surfer;Navigateur
Keywords[it]=Internet;WWW;Browser;Web;Navigatore
Keywords[nl]=Internet;WWW;Browser;Web;Explorer;Verkenner;Website;Surfen;Online 
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/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;application/x-xpinstall;
StartupNotify=true
Actions=NewWindow;NewPrivateWindow;NewSafeMode;ProfileManager;

[Desktop Action NewWindow]
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
Name[nl]=Nieuw venster openen
Exec=firefox -new-window
OnlyShowIn=Unity;

[Desktop Action NewPrivateWindow]
Name=Open a New Private Window
Name[de]=Ein neues privates Fenster öffnen
Name[es]=Abrir una ventana privada nueva
Name[fr]=Ouvrir une nouvelle fenêtre de navigation privée
Name[it]=Apri una nuova finestra anonima
Exec=firefox --private-window
OnlyShowIn=Unity;

[Desktop Action NewSafeMode]
Name=Open in Safe Mode
Exec=firefox --safe-mode
OnlyShowIn=Unity;

[Desktop Action ProfileManager]
Name=Open Profile Manager
Exec=firefox --ProfileManager
OnlyShowIn=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

Answered By: david6

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.

Answered By: Bruno Pereira

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.

Answered By: Binarylife

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.

Answered By: Luis Alvarado

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.

Answered By: Oyibo

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.

Answered By: zfz

I don’t know what is the correct way, but instead of these confusing long answers, I found this simple solution:

  • Run your desktop file from terminal
  • As it opens, a launcher entry is shown for it
  • Now move this entry up or down and the launcher let you to put it there permanently.
Answered By: Ahmad

If you cannot find the .desktop anywhere else:

  1. also look at /var/lib/snapd/desktop/applications/

  2. suppose you are looking for the app Eclipse. Then run

    (find / |grep clipse|grep desktop$) 2>/dev/null

Here I omitted the first letter of the app intentionally,
as this command is case sensitive (and indeed after locating it, the file was named eclipse.desktop)

Answered By: ntg
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.