Adding Programs to Unity in Ubuntu 11+

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a regular release. I like the 5-year long LTS cycle of the even numbers of Ubuntu.

But this upcoming version of Ubuntu LTS (12.04) has gotten rid of the traditional menu system and replaced it with Unity. Like it or hate it, it requires a change, and I could not very well just "upgrade" my workstations. So, in preparation for the move, I installed Ubuntu 11 on a spare laptop to figure out what this "Unity" deal was all about.

I immediately found a problem: How do you add things to the Unity menu system?

A quick Google search answered that question. Run the program, right click it on the Unity task bar, and click Keep in Launcher

But very quickly I found another problem that was not so easily solved: how do you add programs to the Unity Launcher that require a bash command and command line options?

I use KeePass as a password manager religiously. I use DropBox to synchronize the password database between multiple machines so I always have the latest copy. Further, I use Keepass version 2.x because of my need for plugins. Linux has KeepassX, which uses the traditional database format, but because i have a special need, I need Keepass v2.0, which requires the mono framework to run on Linux.

So, my task became clear: how do I put this command on the Unity Launcher:
mono /opt/KeePass/KeePass.exe

Open in new window

It wasn't as simple as you would think. In the older menu system, I could just edit the menu in the Main Menu applet, and poof! it would appear.

Under Unity, however, the steps are more complicated.


Create a .desktop fileUnity uses .desktop files to hold application startup information including command line arguments, what icon you want to use, etc... So, the first step is to create a .desktop file that is appropriate for your application. In my case, it was this file:
[Desktop Entry]
                      Comment=Keepass over Mono
                      Exec=mono /opt/KeePass/KeePass.exe

Open in new window

*It should be noted that I downloaded the Keepass.png file from a Google Image search. It did not come with the package.


Put The .desktop File Where Unity Can Find It.Unity only looks in two places to find .desktop files: /usr/share/applications and ~/.local/applications. If you want the application to be available to all users, copy your newly created .desktop file to the former. If it is just for you, copy it to the latter.


Search for Your Newly Created ApplicationOpen up the Unity Launcher, and search for the item you just created. In my case, it was a search for "Keepass". Click on the result so the program launches.


Pin to the Unity LauncherNow that the program has launched, you can right click the application in the Unity Launcher, and click Keep in Launcher

It's not complicated, but it was poorly documented. And now you know how to do it!

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.