Creating Custom Launchers in Ubuntu 12.04

Creating a custom launcher requires the use of the gnome-panel package. It can be installed as shown:

sudo apt-get install --no-install-recommends gnome-panel

The following command brings up a dialog box to add a laucher to a specified location:

gnome-desktop-item-edit /path/to/desired/location/[filename].desktop --create-new

With root access, the launcher can be added as a global launcher by placing the new launcher in the /usr/share/applications/ folder, then updating the launcher database. Here is a script that demonstrates this:

#!/bin/bash
gnome-desktop-item-edit /usr/share/applications/$1.desktop --create-new
chmod 644 /usr/share/applications/$1.desktop
update-desktop-database
exit 0

The script shown above requires a filename to be specified when the script is run. For example:

./createlauncher test

A new launcher called test.desktop will appear in the /usr/share/applications/ folder.

The script creates a launcher with the gnome-desktop-item-edit command in the /usr/share/applications/ folder, then sets the permissions to 644 to match the other launchers, and finally updates the launcher database so that the new launcher appears in the Ubuntu Dash search.