Nemo Open Terminal doesn't work on remote GVFS locations

Bug #1119283 reported by Tyler Wagner
38
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Linux Mint
New
Undecided
Unassigned

Bug Description

Using Linux Mint 14 nadia 64-bit with Cinnamon, Nemo's Open Terminal doesn't work when run from a GVFS location such as:

sftp://root@192.168.0.1/tmp

In Nautilus, you have two options in the right-click menu in such locations:

Open in Remote Terminal
Open in Local Terminal

The first opens a terminal and calls "ssh user@host" for you. The second opens a normal terminal with the present directory set to the GVFS folder, such as "/run/user/tyler/gvfs/sftp:host=192.168.0.1,user=root/tmp".

In Nemo, only "Open Terminal" appears, and it starts a normal shell in your home directory. Either supporting the Nautilus plugin, or reimplementing its functionality, would be very useful.

Tags: nemo
Revision history for this message
Thimo Kraemer (thimo-kraemer) wrote :

You could create two actions in ~/.local/share/nemo/actions.

File remote_terminal1.nemo_action:

[Nemo Action]
Name=Open in remote terminal
Comment=Open current folder in remote terminal
Name[de]=Im entfernten Terminal öffnen
Comment[de]=Aktuellen Ordner im entfernten Terminal öffnen
Exec=<remote_terminal.py %F>
Icon-Name=terminal
Selection=none
Extensions=dir;
Dependencies=ssh;

File remote_terminal2.nemo_action:

[Nemo Action]
Name=Open in remote terminal
Comment=Open this folder in remote terminal
Name[de]=Im entfernten Terminal öffnen
Comment[de]=Diesen Ordner im entfernten Terminal öffnen
Exec=<remote_terminal.py %F>
Icon-Name=terminal
Selection=s
Extensions=dir;
Dependencies=ssh;

And finally a Python script remote_terminal.py:

#!/usr/bin/env python2
# -*- coding: utf-8 -*-

import sys
import subprocess

path = sys.argv[1]

if '/sftp:' in path:
    sftp = path.split('/sftp:', 1)[1]
    settings = {}
    options, sep, settings['path'] = sftp.partition('/')
    for opt in options.split(','):
        name, sep, value = opt.partition('=')
        settings[name] = value

    cmd = ['gnome-terminal', '-e',
        'ssh %(user)s@%(host)s -t "cd /%(path)s && bash --login"' % settings]
else:
    cmd = ['gnome-terminal', '--working-directory', path]

subprocess.call(cmd)

Revision history for this message
geobernadotte (geobernadotte) wrote :

well, tried to do this hack, but besides that it now shows the actions in the context menu, nothing happens when I click them.
I actually switched to Linux Mint some years ago cause there "was" this open in remote terminal there by default.
cd-ing around in a terminal in comparison to some fast GUI-actions is sooooo backwards!

Please, have someone introduce the old behaviour again by default!

p.s. where has the python script to be saved to? Is it correctly formatted? Does it need special rights etc.? (not familiar with python and such stuff)

Revision history for this message
Thimo Kraemer (thimo-kraemer) wrote :

All files must be placed in ~/.local/share/nemo/actions.

remote_terminal.py must be set executable.

Revision history for this message
Lars Hahn (lhahn) wrote :

For those, who are interested in a soltion, that works on Linux Mint 19.2:

I changed the python script from above a little bit:

#!/usr/bin/python2
# -*- coding: utf-8 -*-

import sys
import subprocess
import getpass

path = sys.argv[1]
user = getpass.getuser()

if '/sftp:' in path:
    sftp = path.split('/sftp:', 1)[1]
    settings = {}
    settings['user'] = user
    options, sep, settings['path'] = sftp.partition('/')
    for opt in options.split(','):
        name, sep, value = opt.partition('=')
        settings[name] = value
    cmd = ['gnome-terminal', '-e',
        'ssh %(user)s@%(host)s -t "cd /%(path)s && bash --login"' % settings]

else:
    print("HERE")
    cmd = ['gnome-terminal', '--working-directory', path]

subprocess.call(cmd)

This solution works for me fine!

Revision history for this message
Lars Hahn (lhahn) wrote :

Okay ... the

print("HERE")

command can be deleted; i though i cancelled all debugging stuff...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.