I am currently using the latest Ubuntu on Dell XPS 13. It works great, and using it is a real pleasure. However, after a while, I got an idea to add the SSH menu to the Unity launcher for enhanced usability.

Shell script

Create shell script to generate and display a list of available SSH servers using zenity utility and ~/.ssh/config user configuration file.

#!/bin/sh
# Create menu for SSH servers using zenity utility

# get SSH servers
ssh_servers=$(awk '/^Host / {print $2}' ~/.ssh/config)

# print SSH menu
server=$(echo "$ssh_servers" | zenity --list --title "Quick SSH menu" --text "Choose SSH server"  --column "Server" 2>/dev/null)

# execute action
gnome-terminal --command "ssh $server"

Store it as ~/bin/create_ssh_menu.sh file and set executable bit.

Desktop file

Create a desktop entry file to use the above-mentioned shell script and define an additional menu.

[Desktop Entry]
Version=1.0
Type=Application
Name=SSH servers 
Icon=application-x-remote-connection
Exec=/home/milosz/bin/create_ssh_menu.sh
Terminal=false
Categories=Network;
Actions=ServerA;ServerB;ServerC;ServerD;

[Desktop Action ServerA]
Name=Connect to router at home
Exec=gnome-terminal -e "ssh -l root 192.168.0.254"
OnlyShowIn=Unity;

[Desktop Action ServerB]
Name=Connect to knowledge base at home
Exec=gnome-terminal -e "ssh 192.168.0.200"
OnlyShowIn=Unity;

[Desktop Action ServerC]
Name=Connect to OSMC at home
Exec=gnome-terminal -e "ssh -l pi 192.168.0.201"
OnlyShowIn=Unity;

[Desktop Action ServerD]
Name=Connect to web server
Exec=gnome-terminal -e "ssh blog.sleeplessbeastie.eu"
OnlyShowIn=Unity;

Store it as ~/.local/share/ssh_menu.desktop file and use desktop-file-validate command to validate its contents.

Do not forget to update the path to the shell script.

Unity launcher

The last step is to add the created desktop entry file to the Unity launcher. You can do this by hand (drag file to the launcher) or just execute the following command.

$ gsettings set com.canonical.Unity.Launcher favorites \
  "$(gsettings get com.canonical.Unity.Launcher favorites | \
     sed "s|\]|,'application://ssh_menu.desktop'&|")"

References