87

How do you create a custom application launcher in Gnome Shell?

I have a local Eclipse installation that I'd like to be to quickly launch. So I created a symlink to the eclipse binary and placed it on my desktop. If I open a terminal, cd to ~/Desktop and run ./eclipse it starts Eclipse perfectly. However, if I click the Eclipse icon on my desktop, and choose run, nothing happens.

Alternatively, I wouldn't mind being able to search for Eclipse on the "Activities" screen, but I can't find any documentation on adding or registering custom applications.

pomsky
  • 70,797
Cerin
  • 6,943

7 Answers7

133

Try to create a eclipse.desktop file under /usr/share/applications (or ~/.local/share/applications or directly in ~/Desktop) with the following content:

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse IDE
Exec=/path/to/eclipse/executable
Icon=/path/to/eclipse/icon
Type=Application
Categories=Development;

You can choose another category, too. For additional information: categories available.

Line
  • 401
  • 1
  • 5
  • 19
tohuwawohu
  • 7,522
  • 12
    Thanks. The only problem I ran into, which the docs don't mention, is that the file has to be executable if you place it in ~/Desktop. Otherwise it just shows up as an ordinary text file and isn't launchable or rendered with the right icon. – Cerin Mar 12 '12 at 17:35
  • 5
    You might find that you need to restart gnome3 for this to take effect, especially the icon. If so, run Alt+F2, type r in the box, and press enter. – mlissner Nov 18 '15 at 23:33
  • 2
    Your application may require a working directory, use Path=/path/to/eclipse/working-dir. – psiphi75 Apr 18 '17 at 04:39
  • it seems like the executable path (when the file is under ~/.local) can be relative (to home directory), but the icon path must be absolute.. – Line Apr 04 '24 at 11:09
20

Although creating your own launcher by hand is a valid solution, my preferred one is to go through alacarte and create a new entry on the menus, then it will appear as a launcher.

m0skit0
  • 315
  • 8
    Thanks, I could not believe my eyes that to add a simple entry in my modern Desktop environment, i needed to create a 10-lines text file in a hidden directory in my home folder, by hand. This should be the winning answer. – Luis Muñiz Jul 06 '17 at 22:45
  • Once you've created a new launcher in the menu, you can search for it in the activities screen and then drag it to your panel. – MathKid Jul 29 '17 at 16:00
  • @CodeKid Yeah that's what I meant :) – m0skit0 Jul 31 '17 at 08:39
  • I've added a blog post on what is the exact name and how to use it. – kissu Nov 18 '21 at 12:31
  • 1
    The link in this is dead and takes you to Lifewire's home page. Suggest removing or updating the link, it looks sus. – Bob Liberatore Nov 25 '23 at 21:11
4

In newer Gnome versions Comment and Terminal sections become mandatory so minimal .desktop file is now:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Sample Application Name
Comment=A sample application
Exec=application
Icon=application.png
Terminal=false
3

The easiest way I have found to create launchers using a full-featured GUI is vie MenuLibre, which is in the Ubuntu repositories. It will hold your hand through the process and allow you to create a custom launcher in a fast and straightforward manner, as long as you know where your resources reside (binary location, icon location, working directories, etc). Alacarte does not work reliably for me.

ethan
  • 324
2

If you want a list of custom launchers you can access from the panel you could use the MyLauncher extension. MyLauncher Gnome Shell Extension

mark
  • 41
1

If you want proper shortcut, then do following:

  1. go to /usr/share/applications
  2. coppy one of the *.desktop files to this location with the name you intend to use as application name;
  3. adjust the executable path
  4. adjust the icon path 5! check carefully for all the places in this file where old references are, and edit them to your needs.
0

After having some trouble with an executable path that contained spaces and no satisfactory answer nearby, I try to summarize everything once again in 2025. Works for me on GNOME Shell 48.4.

Basic structure

Create a file named your-program.desktop in folder ~/.local/share/applications with the following content:

[Desktop Entry]
Type=Application
Categories=Development;Graphics
Name=Your Program
Comment=A possibly longer comment describing what Your Program is good fore
Exec=your-executable
Icon=/full/path/to-image.png
Terminal=false

You need to change the following fields:

Categories

Pick one or multiple of the main categories Audio, AudioVideo, Development, Education, Game, Graphics, Network, Office, Science, Settings, System, Utility, Video, separated by ;. You may go overboard and add some of the numerous additional categories as well.

Name & Comment

Just a bare single-line string, no quoting needed.

Exec

Typical cases here are:

  • A bare exec-name if it is found in $PATH (e.g. gimp)
  • Full path to an executable (e.g. /usr/bin/vlc)
  • One of the above but with arguments (e.g. /usr/bin/vlc --started-from-file %U), split by whitespace
  • If the executable path/filename or one of the arguments contains whitespace that needs preserving, you can quote them with single (not double) quotes: '/home/ojdo/bin/Some App With Spaces.AppImage'.
  • Further rules on escaping, quoting and defined variables like %F and %U can be found in the official Exec key specification.

Changes to this file are picked up automatically after some seconds. When in doubt, change the Icon field to a different picture to see when the update has caught on.

ojdo
  • 147