How to create a custom Unity launcher for a Java app (eg. SQuirreL SQL Client)

Take a look at the *.desktop file of jEdit (it's a text editor written in Java and ships in Ubuntu's universal repository). First of all: create a copy of jedit.desktop and modify all the relevant entries. Most of them are relevant. Smile
Now the problematic entry is StartupWMClass. If you don't set up this correctly, Unity won't be able to "identify" the process/window that is launched by the executable specified by the "Exec" entry.
You can start up SQuirreL and use xprop to get the correct value. I'll help you: it's "net-sourceforge-squirrel_sql-client-Main"

So a proper squirrel.desktop file looks like this:
[Desktop Entry]
Name=SQuirreL
GenericName=SQuirreL SQL Client
Comment=Browse/edit SQL databases
Exec=/opt/SQuirreLSQLClient/squirrel-sql.sh %U
Icon=/opt/SQuirreLSQLClient/icons/acorn.png
Terminal=false
Type=Application
Categories=Development;
StartupNotify=true
MimeType=text/x-sql;
StartupWMClass=net-sourceforge-squirrel_sql-client-Main
Keywords=Programming;Java;SQL

(Of course assuming that SquirreL is installed in /opt/SQuirreLSQLClient)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Then what???

After I've created the desktop file, how do I add it to my unity launcher?

Re: Then what???

Place the desktop file in your $HOME/.local/share/applications folder and the custom launcher will show up in your Dash, when you start entering the first letters of it's title. If you got this, you can launch the app from Dash. Once it's running, you can right-click the icon of the running app and make it stick.

Thanks

This post really helped me.

I still have two questions:
1.What dose the %U of executed bash means?
2. What is the meaning of "WM"? and why I can not lock auto-generated Squirrel desktop entry to Unity if StartupWMClass of it is missing or incorrect?

Appreciated.

Re: Thanks


  1. The meaning of %U is: "A list of URLs. Each URL is passed as a separate argument to the executable program. Local files may either be passed as file: URLs or as file path."
  2. The StartupWMClass means: "The application will map at least one window with the given string as its WM class or WM name hint (see the Startup Notification Protocol Specification for more details)."
    The "WM" stands for window manager. And locking a desktop entry to the Unity launcher apparently requires that Unity can match an X11 window with a desktop entry based on the WM_CLASS property of the window and the StartupWMClass property of the desktop entry.
Syndicate content