<

[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x

Adding Programs to Unity in Ubuntu 11+

Published on
9,401 Points
3,301 Views
1 Endorsement
Last Modified:
Approved
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.

1.

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]
Version=1.0
Type=Application
Terminal=false
Name=Keepass
Comment=Keepass over Mono
Exec=mono /opt/KeePass/KeePass.exe
Icon=/opt/KeePass/Keepass.png

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.

2.

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.

3.

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.

4.

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!
1
Comment
Author:DrDamnit
0 Comments

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Join & Write a Comment

How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Screencast - Getting to Know the Pipeline

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month