Stunkymonkey / nautilus-open-any-terminal

GNU General Public License v3.0
568 stars 59 forks source link

ptyxis flatpak package #163

Closed arigit closed 4 months ago

arigit commented 4 months ago

The current ptyxis flatpak package from flathub install as:

flatpak list |grep Pty Christian Hergert app.devsuite.Ptyxis 46.2 stable system

This is by default hence not working with this nautilus extension. Modifying the sourcecode to point to app.devsuite.Ptyxis makes it open (a new tab)

vim ~/.local/share/nautil/extensions/nautilus_open_any_terminal.py

I suggest making the flatpak path configurable via dconf-editor since it seems to be a moving target.

However, it always opens in the home folder, it doesn't open the folder that nautilus has open, either local floder or remote (sftp) folder.

arigit commented 4 months ago

I tried to fix the working directory problem by doing,

    "ptyxis": Terminal(
        "Ptyxis",
        command_arguments=["-x"],
        new_tab_arguments=["--tab"],
        new_window_arguments=["--new-window"],
        workdir_arguments=["--working-directory="],
        flatpak_package="app.devsuite.Ptyxis",
    ),

but that did not work. invoking the flatpak manually with a working directory argument works fine though

lvxnull commented 4 months ago

Please try installing this extension from the latest commit on master and see if this issue still exists.

arigit commented 4 months ago

@lvxnull I installed it from source and noticed that the flat package had been corrected already. Initially, same issue (always opening the terminal on ~) but after changing a setting in ptyxis, now opening a terminal from Nautilus (either local folder, or "Local Terminal" for remote folders) works fine! the setting I had to change is:

Ptyxis > Settings > Behavior > Shell > Preserve Working Directory = Always

image

What still doesn't work is "Open Remote Ptyxis Here" - when selecting this (while browsing a remote sftp folder in nautilus), nothing happens, no New Tab (or window) opens at all.

arigit commented 4 months ago

For reference, the below works well and opens a new "remote tab" in a specific folder when executed from a command line:

flatpak run app.devsuite.Ptyxis --tab -x """ssh arigit@192.168.1.8 -t 'cd /home/arigit/temp; bash' """

# this works as well:
flatpak run app.devsuite.Ptyxis --tab -x """ssh arigit@192.168.1.8 -t fish -i -C \'cd /home/arigit/temp\' """

notice the triple double-quotes that I had to use around the command. I notice from the source that nautilus-open-any-terminal uses Popen so not sure how the triple double-quotes can be included. Maybe using subprocess with Shell=True would work better in this case.

lvxnull commented 4 months ago

This is because "-x" takes a single string but we're passing the command as multiple arguments. I'll submit a PR fixing this shortly. Also there's no such thing as triple quote in posix sh. You're doing the equivalent of "" + "some string" + "" in python.

arigit commented 4 months ago

That worked great, thanks!