Open JayDoubleu opened 3 years ago
Where did you get a flatpak build of Terminator from? It's been on my todo list for a while but I've never used flatpak, and I haven't had time to do the research to build up a flatpak build yet. Did Redhat build one up? If we can get access to the flatpak build we can suggest a patch for flatpak that will do the right thing for the flatpak package.
The best thing I can think I can think of is to add a profile, or change the default profile to have flatpak-spawn --host $SHELL
to be the default command that runs on terminal launch.
No, redhat didn't yet build one. I've had a go at it and it looks promising so far. Have a look here: https://github.com/flatpak-rpm-builds/com.tenshu.terminator
I know that the toolbox
tool on fedora also uses flatpak-spawn
so it could be potentially used for development without having to build/rebuild the flatpak.
@mattrose this is now on https://src.fedoraproject.org/flatpaks/terminator/tree/master Fedora builds flatpaks as OCI containers from RPM so essentially this is mostly ready for implementation and it will pull your latest RPM if it becomes available in fedora repos (with flatpak-spawn fixes). From there there is a short route to get it into fedora flatpak registry if folks at fedora decide to include it there.
Ps. I've changed the app id to match your dbus name net.tenshu.Terminator2
I'm happy to be your guinea pig for testing if needed. Give me a shout if you would like some help setting up development environment.
I'll play with this a bit, I think the only thing we need is a way to detect that we're in a flatpak environment, and set the command appropriately. Is there a standard way of detecting that you're running in a flatpak sandbox?
Apparently the common approach is to check if /.flatpak-info
exists.
I'm not sure if simply firing the spawn command will produce stable terminal experience tho.
Looks like Tilix does it with custom bin mentioned here: https://github.com/gnunn1/tilix/blob/787e5335ecef9cada035170eeaedb301f567127d/source/gx/tilix/terminal/terminal.d#L3061..L3064
https://github.com/gnunn1/tilix/blob/master/experimental/flatpak/tilix-flatpak-toolbox.c
yeah, so I tried it, and if you alter the default profile in the Preferences UI so that it runs flatpak-spawn --host /bin/bash
it starts and runs in the host OS just fine. I'm not sure how to plumb this in to the flatpak manifest so it configures terminator to do this by default, but I think that might be the best way to achieve what you're looking for.
The issue is that flatpak-spawn produces unstable shell experience. Looks like tilix discovered that quite some time ago and developed something slightly better.
Flatpak is using the "flatpak-spawn" command to escape from the sandbox and run commands on the host.
Tilix has implemented the below so it automatically spawns shell on the host instead of the container https://github.com/gnunn1/tilix/blob/787e5335ecef9cada035170eeaedb301f567127d/source/gx/tilix/terminal/terminal.d#L2825..L2833 https://gitlab.gnome.org/GNOME/gnome-builder/-/blob/master/src/libide/threading/ide-flatpak-subprocess.c#L549
Would it be possible to look at the implementation in terminator ? Here is an example of python running flatpak's "HostCommand"
https://stackoverflow.com/questions/39494813/pass-file-descriptor-via-a-dbus-function-call-from-python-aka-call-flatpaks-ho
Currently I can launch terminator from flatpak but I have to run
flatpak-spawn --host zsh
from within terminator and this is not persistent across tabs.Alternatively, if there would be a way to pass default run command to terminator as an argument for example:
--default-shell="flatpak-spawn --host $SHELL"
which would apply to all tabs overwriting the config.