rss feed Twitter Page Facebook Page Github Page Stack Over Flow Page

Creating a custom launcher in Unity

I previously showed two (2) methods on how to create new launcher items in unity. But is it possible to create a sub list or menu in each of these applications?

Yes, it is possible, and it is actually a simple solution.

The key to make this to work is the X-Ayatana-Desktop-Shortcuts. This allows Unity to look for groups within the .desktop filename and automatically create the new contextual list or menu. X-Ayatana-Desktop-Shortcuts requires at least one (1) name. If you need more than one (1), you need to separate them using the semicolon (;) character. Example:

X-Ayatana-Desktop-Shortcuts=Name1;

Or

X-Ayatana-Desktop-Shortcuts=Name1;Name2;Name3

Let's use the terminal example. I want to create a list of terminals I connect to for maintenance. I am going to have 2 servers, and I would like to be able to have the list when I right-click on the icon.

[Desktop Entry]
Name=Terminal
Comment=
Exec=gnome-terminal
Icon=utilities-terminal
Type=Application
Terminal=false
StartupNotify=false
X-Ayatana-Desktop-Shortcuts=Server1;Server2

[Server1 Shortcut Group]
Name=SSH server1.remote
Exec=gnome-terminal --class=remoteserver -x ssh server1.remote
TargetEnvironment=Unity

[Server2 Shortcut Group]
Name=SSH server2.remote
Exec=gnome-terminal --class=remoteserver -x ssh server2.remote
TargetEnvironment=Unity

This will show something like this:

Creating a custom launcher in Unity