Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion nautilus_open_any_terminal/nautilus_open_any_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ def run_command_in_terminal(command: list[str], *, cwd: str | None = None):
cmd = parse_custom_command(custom_remote_command, command)
else:
cmd = terminal_cmd.copy()
# Remove '--new-window' argument for Ptyxis remote sessions (fixes window size reset)
if terminal == "ptyxis" and (command and command[0] == "ssh"):
del cmd[1]
if cwd and terminal_data.workdir_arguments:
cmd.extend(terminal_data.workdir_arguments)
cmd.append(cwd)
Expand Down Expand Up @@ -249,7 +252,17 @@ def open_remote_terminal_in_uri(uri: str):
def open_local_terminal_in_uri(uri: str):
"""open the new terminal with correct path"""
result = urlparse(uri)
filename = unquote(result.path)

# For remote URIs (sftp/ftp), get the GVFS mount path instead of parsing the URI
if result.scheme in REMOTE_URI_SCHEME:
gfile = Gio.File.new_for_uri(uri)
filename = gfile.get_path()
if not filename:
print(f"open-any-terminal: Could not get local path for {uri}")
return
else:
filename = unquote(result.path)

if result.scheme == "admin":
run_command_in_terminal(["sudo", "-s"], cwd=filename)
return
Expand Down