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.

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 MironovJun 5 '11 at 20:50

7

It's ridiculous how difficult it is to create a shortcut to an app. If Windows can make is so easy, why can't Ubuntu?
– Dan DascalescuAug 15 '15 at 10:13

Have a look at Xubuntu: Xfce has very elegant support for this through the menu editor. Launchers can subsequently be added to the desktop through a context menu.
– 魔大农Nov 13 '15 at 20:07

15 Answers
15

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

This answer solves it. But I ask myself: Why is this answer needed? I think unity should support this in a way which does not need an explanation. A more easy solution would look like this: right click, choose "Add" ...
– guettliJan 7 '15 at 20:45

6

@guettli It's unbelievable, isn't it! Guess it's part of the "we hate end user customisation" which means you can't move the panel to the bottom of the screen, barely change the launcher behaviour, move the close/minimize etc icons to the right of the windows etc.
– user12753Mar 15 '15 at 16:37

1

To clarify: The files in /usr/local/share are the launcher scripts created during application install. (as above) I recommend copying these to .local/share BEFORE attempting any further customisation.
– david6Mar 25 '16 at 22:05

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 AlvaradoApr 25 '12 at 20:02

How on earth does this answer have less up-votes than the others? This is the FASTEST, SIMPLEST, MOST CORRECT answer!
– copoliiNov 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
– stivloNov 26 '11 at 17:03

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.

This is the one that worked for me in Ubuntu 12.04
– LnxSlckApr 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.
– rynopApr 30 '12 at 13:40

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

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:

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.

Worked with 14.04. If you move the icon to the launcher, however, and then delete the parent icon on the desktop (for cosmetics), the icon on the launcher will disappear too.
– XavierStuvwJan 10 '18 at 12:00

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. hollenbeckSep 20 '11 at 17:57

Icons can be rearranged by clicking and holding the icon for few seconds.
– andhoOct 17 '11 at 10:22

What if I want to create a launcher for a Python script?
– It's WillemJun 10 '15 at 17:14

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.

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:

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:

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

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

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:

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.

You can just copy it to ~/.local/share/applications so you don't need to mess with the sudo.
– Jorge CastroMar 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.
– BazonMar 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.
– BazonMar 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.
– BazonMar 16 '11 at 17:25

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

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 WilkeOct 29 '12 at 1:45

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

Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).