Adding a launcher to Ubuntu’s Unity desktop via keyboard

Hi there,

Recently I have reinstalled Ubuntu 14.04 on my computer. I realized that (of course) all of my desktop shortcuts were gone. There is a pretty straightforward way to add them back via command line.

After installing the Gnome-Panel with:

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

you just have to open up a terminal window and typing in:

gnome-desktop-item-edit ~/Desktop/ --create-new

This is nothing special or new. This method is going around the Internet since the Unity desktop was introduced with 11.04. What I am missing on this method is the absence of the terminal. Because after a while I can not exactly recall the code or i am too lazy going through the history of my terminal window with the ARROW UP key. I would like to have a keyboard shortcut that lets me add a launcher right to my Desktop.

Fortunately Linux offers a way to accomplish this task with a shell script that will be executed with a keyboard shortcut.

I would like to show you this method in the following few steps. The term “username” has to be replaced with your user name on your Linux environment.

  1. Create an empty document in /home/username and call it addShortcut.sh. Call it whatever you like as long you keep the .sh ending for a shell script.
  2. Open your new file in a text editor (e.g. gedit, nano). And type in:
    gnome-desktop-item-edit ~/Desktop/ --create-new

    Save your file.

  3. Make your file executable either through the terminal by typing in
    chmod +x addShortcut.sh

    or right-click on the file and under Properties>Permissions set the checker under Execute.

  4. Go to the keyboard under system settings and select the Shortcuts tab then click on Custom Shortcuts.
    shortcuts_001
  5. Click on the plus button. In the window that appears give a name to your new shortcut (e.g. addShortcut) and under Command add the full path with the name of the shell script.
    In this case:/home/username/addShortcut.sh

    Click on Apply.

  6.  Finally we have to define a key combination to call our script. Click on the Disabled tag on your new shortcut and select a key combination of your choice.
    (e.g. SHIFT+CTRL+ARROW UP)
    shortcuts_002

Now you can create a desktop shortcut with a key combination. 😉

Regards