Tag/tag.png

Needs Updating
This article needs updating to include the latest versions of Ubuntu. More info...

Launchers are similar to "shortcuts" in Windows or "aliases" in the Mac OS. Adding a launcher in Ubuntu is easy.

The Easy Way

  • Right-click unused space in any panel (the toolbars at the top and/or bottom of the screen)
  • Choose Add To Panel...
  • Choose Custom Application Launcher
  • Fill in Name, Command, and Comment

    • Name is you want to call the link, such as "Firefox" or "Gaim"

    • Command is what you would type in the terminal to launch the program. You can also click the "Browse" button to find the program on your computer.

    • Comment is for a short explanation of the program. This and the Name will appear when you hover your mouse over the launcher.

  • Click the No Icon button to select an icon for your launcher. You may find icons in /usr/share/icons/crystalsvg/16x16/apps/ or elsewhere. You could also make them yourself using GIMP or any other graphic editor.

  • Click OK

  • Your launcher should now appear on the panel

You may also find directions on adding launchers in Ubuntu's built-in help. From the System menu select "Help and Support" then "Customising Your Desktop > Cutomising Panels > Launchers."

The Hard Way

What if this does not work?

Some programs need additional commands before they can be started. Java programs need to be started from within the directory in which their files exist. Others must be run within Wine. Unfortunately launchers do not have access to the Bash environment so you cannot just include the needed commands.

Instead, you need to make a Bash script (don't worry, it's simple).

  1. Create a new text file somewhere on your computer. Open a terminal window and type

    sudo nano /usr/local/bin/sampleprogram
  2. Fill the new file with this:

    <your command>
    <your command>
    <your command>
  3. Press Control+X to save your file & exit Nano.

  4. Make the file executable by typing the following in the terminal:

    sudo chmod +x /usr/local/bin/sampleprogram
  5. In the Create Launcher window, fill Command with /usr/local/bin/sampleprogram (or just sampleprogram, but be sure to update your database before that by typing the following in the terminal:

    sudo updatedb

Examples of Bash scripts

Here are a few other examples of Bash scripts:

#/bin/bash
WINEDLLOVERRIDES=\"ole32,usp10,msvcrt=n\"
wine $HOME/.wine/drive_c/Program\ Files/Google/Google\ Earth/GoogleEarth.exe

cd $HOME/Movietheque/
$HOME/Movietheque/Movietheque.run

An Alternative to Bash Scripting

As an alternative to Bash scripting, you may wish to try wrapping your command(s) in quotes, prefixed by a call to a command interpreter (sh, bash, etc...). Invoking a program through a command interpreter allows you to combine multiple commands in a single launcher. Additionally, this method is useful for running visual and interactive programs (such as remote desktop) from a custom terminal command. The following examples use Dash ("sh"):

sh -c "ls -al 2>&1 | tee ~/myLog.log; gedit ~/myLog.log"

The above command provides an example of combining two or more commands using a semicolon.

sh -c "xtightvncviewer my.server"

Replace my.server in the above example with the address of a VNC server (assuming xtightvncviewer is installed) and the remote desktop will be opened in a new window.

Note: In both examples, the launcher should be set to run as an "Application in Terminal"


HowToAddaLauncher (last edited 2015-04-24 18:55:26 by 91ECDBAD)