sshlist – an appindicator/unity replacement for sshmenu

sshlist in action

sshlist in action

[Note: SSHlist has been deprecated,in favor of SSHplus. SSHlist will no longer be developed, but is still made available]

Since moving to Ubuntu Natty, I’ve missed the sshmenu applet a lot.

So I spent an hour to writeup a functionally equivalent appindicator menu. And so sshlist was born.

Using sshlist is simple. From the instructions:

  • Copy file sshlist.py (this file) to /usr/local/bin
  • Edit file .sshlist in home directory to add ssh host (one per line)
  • You can if you wish add additional ssh options. The line is appended to the ssh command
  • Launch sshlist.py
  • Or better yet, add it to gnome startup programs list so it’s run on login.

Of course, much of that could be automated, patched and/or packaged. For now simply head to the repository, click on “sshlist.py” and grab the raw file, and follow the above instructions.

Patches welcome.

Update: Benjamin Heil extended sshlish for simplestarter, which allows launch of multiple applications with various arguments. It might suit your needs.

Update 2: SSHplus is better! This version will no longer be maintained.

21 Comments

  1. Calum says:

    Hi this is great!

    I have added it to Askubuntu’s list of app indicators:
    http://askubuntu.com/questions/30334/list-of-application-indicators/44082#44082

  2. edekzkrainykredek says:

    Thank you for this piece of code!

  3. Ex says:

    It’s very nice utility.
    Only few thing i miss for perfection: Possibility to name the connections and folders. Too bad that i can’t python.

  4. Tauren says:

    This is great, thanks for the work! I have a few thoughts and suggestions on how it could be improved, if you are interested.

    1. I’d love if it could display a name instead of the command. Some of my SSH commands get long and it is harder to determine exactly what host I’m connecting to. For instance, the following command logs me into “internalhost”, not “externalhost”:

    -A -t me@externalhost.mydomain.xyz “ssh -A internalhost”

    2. Being able to select a profile and geometry was really helpful in SSHMenu. Is this possible with SSHList? I use different profiles for production, staging, and dev servers. Seeing a different color scheme quickly lets me know how careful I need to be on that particular host.

    3. I like the dividers and submenus that SSHMenu provided, but this is of much less importance.

    4. In the best possible world, SSHList would be able to transparently use the .sshmenu config file. Perhaps if .sshlist doesn’t exist, it looks for .sshmenu and loads it instead. That would be totally sweet! I realize sshlist would then need to know how to parse the custom .sshmenu format, but it would certainly be handy.

    I might be able to hack some of this together, but I’m not a python guy and it would take me a lot more than the hour it took you to build the whole thing!

  5. admin says:

    Adding these features to sshlish would basically mean writing a preferences form from where to edit these entries. Or I could add the the existing one-per-line format and separate various fields via commas.. so the entries would look like ssh-params[,displayname][,profile][,geometry]

    So the file could look like

    foo@bar.com
    foo@example.com, fo at example, remote-profile

    The idea to parse sshmenu would actually make sense. Rather than creating my own format, I could use sshmenu.. it doesn’t seem to hard to parse.

    Of the above two options, which one sounds better?

  6. Tauren says:

    A preferences form would be great eventually, but just doing a comma-delimited config file would be fine for now! It would make it much more friendly and probably wouldn’t take much time to implement.

    I changed sshlist.py to have the following, but it isn’t customizable per host. Adding the comma-delimited config would solve this:
    run_program(“gnome-terminal –window-with-profile=Custom –geometry=135×47 -x ssh ” + buf)

    Alternatively, being able to read the sshmenu config file would be nice as well. Here’s a sample of it’s format:


    items:
    - items:
    – title: VM Host
    profile: VM Host
    sshparams: -A -t user@proxy.myhost.com “ssh -A user@vmhost”
    type: host
    geometry: 123×45+3-28
    – title: Production Web
    profile: Production
    sshparams: user@myhost.com
    type: host
    geometry: 123×45+1633+182
    – title: Production Database
    profile: Production
    sshparams: user@db.myhost.com
    type: host
    geometry: 123×45+1630+159
    – title: Staging Web
    profile: Staging
    sshparams: user@stage.myhost.com
    type: host
    geometry: 123×45+1757+161
    – title: Staging Database
    profile: Staging
    sshparams: user@stagedb.myhost.com
    type: host
    geometry: 123×45+1630+159

  7. Tauren says:

    Note that the sample config file I pasted needs to have indentation. It was lost when converted to HTML.

  8. Mike says:

    Cool stuff – unfortunately it doesn’t work for me: When i start the script, the icon appears in the panel. But on click nothing happens. No menu opens. I’ve added “print host” for testing in line 65 – it shows the entries from ~/.sshlist just fine.

    What could be wrong?

  9. admin says:

    Hmm.. it seems to be working for everyone. I do know there’s a unity bug where if you’ve enabled legacy taskbar icons, then clicking on the leftmost appindicator wont be recognized.. in this case, click on the power/time/volume icons, and then drag the mpose pointer left onto the ssh indicator.

  10. Mike says:

    Strange, it works now. Maybe it was fixed by rebooting. Thanks anyway!

  11. Mike says:

    Sorry, still struggling: I found out that the menu does not always come up when i click the icon.

    The strange thing is this: If i click the icon next to it (e.g. the WLAN icon) then move the the mouse pointer over the sshlist icon after the LAN menu opened, the SSH menu suddenly opens.

    So at least i have a workaround :) Still i wonder why it doesn’t work correctly. Any ideas?

  12. admin says:

    @Mike: yeah.. look at my comment above. This is a bug in unity.

  13. Lemo says:

    I’ve been following this thread for a few weeks and very much appreciate Anil’s efforts to get an sshmenu-like app going for Natty. In the meantime, I’ve come across PAC Manager which is a pretty good sshmenu alternative with an active and responsive developer.

    It’s available from:

    http://sourceforge.net/projects/pacmanager/

    There is a dependency issue in Ubuntu but easily fixed:

    http://sourceforge.net/tracker/?func=detail&aid=3064967&group_id=299598&atid=1263752

  14. admin says:

    Bejamin Heil extended sshlish for simplestarter, which allows launch of multiple applications with various arguments. It might suit your needs too.

    http://www.bheil.net/blog/2011/07/07/simplestarter-simple-application-starter-appindicator

  15. Peter says:

    Can this code be modified so that it works in gnome-shell (Fedora 15, Gnome 3)?
    I think it would need to use some other function instead of Appindicator.

  16. admin says:

    Peter you could just use sshmenu (i think gnome3 supports the old gnome panel widgets). This was made specifically for appindicator, but you’re free to modify it if you wish.

  17. Peter says:

    Hi, i tried the old sshmenu, but unfortunately gnome3/gnome-shell does not support it. So i was glad to see some movement in the right direction. Unfortunately, I’m not a programmer, so I think I won’t be able to do this myself.

  18. [...] Essays « sshlist – an appindicator/unity replacement for sshmenu [...]

  19. admin says:

    Tauren: I;ve modified sshlist to sshplus that adds support for sshmenu configuration.

  20. seurat says:

    Nice work!
    Unfortunately sshplus will not work for nore complex sshmenu configuration files where you have submenus.

  21. admin says:

    I see.. can you send me a sample sshmenu config that doesn’t work.. so I can debug. My email is on the top-right side. Thanks

Leave a Reply