Thursday, January 5, 2012

Create launcher / shortcut for applications in Ubuntu Oneiric

Everybody have their little scripts for automating anything.  It used to be very easy to create launchers or shortcuts for launching applications in Ubuntu.  It make very little difference if the app is installed software packages or your own little script.  You just right click on the desktop and create a launcher.  You can even move the launcher into your desktop panels for quick launch.

Not anymore.  Ubuntu Oneiric took it all away.  It's still there, and very easy to use.  But it was so simple and transparent that I didn't know the details before.

Basically instead of creating launcher on the desktop, you need to run from a terminal:

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

It's the same as before, when you want to create a launcher on your Desktop.  Give it a name, the path to the application or your script, it's done.  Typically for scripts you check the item "it's application in terminals".  Optionally you can change the icon by clicking on it.

You can drag your launcher icon on the desktop into the unity bar to keep it there always.

You can create a script for the above command, create a launcher for it.  So you never need to type the command again.  (It doesn't work without putting it in a script first.)

Basically a launcher is a simple nameXX.desktop text file anywhere.  From the desktop GUI you see this as a launcher.  Inside is just the name of the app, path of application or script, and path of icon.

Sometimes you can't move the launcher icon into the unity bar for various reasons.  Sometimes it turns into a black block in there.  There may be some legacy problems.  There is an icon path where the icons are to be searched.  This include ~/.icons  If your script have the same name with one of the icons, the icon will be automatically loaded, which may not be your intention.  Etc, etc.

No comments: