Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I would like to be able to click on SSH links that look like ssh://user@servername and have a gnome-terminal open that runs SSH inside of it.

After reading up on the XDG stuff I did the following:

I created a shell script in $HOME/bin/ssh-terminal with the following:

#!/bin/sh
dest=${1#ssh://}
gnome-terminal -e "ssh $dest" &

This works from the command line.

I created $HOME/.local/share/applications/ssh-terminal.desktop with:

[Desktop Entry]
Type=Application
Name=SSH Terminal
Exec=ssh-terminal %u
Icon=utilities-terminal
StartupNotify=false
MimeType=x-scheme-handler/ssh;

I ran update-desktop-database ~/.local/share/applications/

Now when I try to run xdg-open ssh://user@hostname I get the following error:

$ xdg-open ssh://buildbot@10.16.50.74
gvfs-open: sftp://buildbot@10.16.50.74/: error opening location: The specified location is not mounted

I don't want to open it as a sftp mount and I cannot seem to find where that is set!

Where do I go from here?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Writing a .desktop file is not enough. You also need to change the default setting for the mime type.

You can get the current default value with

 xdg-mime query default x-scheme-handler/ssh

and can change it with

 xdg-mime default ssh-terminal.desktop x-scheme-handler/ssh

The corresponding configuration file is $HOME/.local/share/applications/mimeapps.list.

share|improve this answer
    
Sorry about the late accept. This didn't work at the time I asked the question but I just tried it lately and it does now. Thanks. –  Zan Lynx Oct 28 at 21:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.