Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial flatpak-spawn support #570

Merged
merged 3 commits into from
Mar 29, 2022

Conversation

JayDoubleu
Copy link
Contributor

This is adding experimental flatpak support as well as definition.

It builds and works ok however flatpak-spawn doesn't seem to be handling tty properly (see flatpak/flatpak#3697)

It's usable and perhaps could be submitted to flathub beta and wait until flatpak-spawn resolves issues with tty or someone rewrites it.

Fixes: #206

@JayDoubleu JayDoubleu force-pushed the flatpak_experimental branch 4 times, most recently from 137a343 to d5878fc Compare January 23, 2022 15:04
@JayDoubleu
Copy link
Contributor Author

JayDoubleu commented Jan 23, 2022

@mattrose Could you please have a look at the latest changes. I believe this should make it a stable experience when running in flatpak. It also fixes the #347

I these python changes make it to a release, fedora might include terminator as flatpak by default in their remote and it can also be submitted to flathub separately.

Only difference on how it works in flatpak I can see right now is that the config file should be edited in ~/.var/app/net.tenshu.Terminator2/config/terminator/config instead of usual config place.

@mattrose
Copy link
Member

I will definitely take a look at this, but It'll take me a bit because I want to give it a good once-over, and it's a lot of code to digest in an area I'm unfamiliar with. Hopefully before the end of the week. Fedora has included terminator as an rpm at least for the past 10 years or so. @dmaphy and I have been maintaining it. I'm not sure how to convert the fedora rpm into a flatpak, but maybe we can work that out as well as putting it up on flathub.

@JayDoubleu
Copy link
Contributor Author

JayDoubleu commented Jan 23, 2022

No worries, I can help out with building it against fedora runtime as well.
I already opened a repository here https://src.fedoraproject.org/flatpaks/terminator
It essentially works by sourcing your RPM so if the changes within terminator source code get approved and make it's way to https://src.fedoraproject.org/rpms/terminator then it should be really easy to get it published to fedora.

Nice thing about fedora flatpaks is that once the flatpak manifest has been written and accepted it just uses your RPM to build itself every time there is update to your RPM so you only have to maintain your RPM repo.

They key to getting it working properly in flatpaks was to make terminator spawn shells using flatpa-spawn otherwise it would always get shell in flatpak sandbox. If that's good to go it should work in both fedora and flathub flatpaks.

@JayDoubleu
Copy link
Contributor Author

JayDoubleu commented Jan 27, 2022

PS. I've added you @mattrose @dmaphy as admins to https://src.fedoraproject.org/flatpaks/terminator and I've also updated it for F35. AFAIK it only needs these steps to run https://docs.fedoraproject.org/en-US/flatpak/tutorial/#_building_in_koji which I can't do myself as I'm not in maintainers group.
I'm also happy to hand that repo over too. I just want terminator in fedora flatpak ;)

@mattrose
Copy link
Member

Thanks for all your work on this.

@mattrose
Copy link
Member

So I've looked this over and I have 2 questions. We have tried hard to keep packaging files like .spec files and the Debian directory out of this repository. The Debian packaging files live in the debian repos, and the fedora packaging files live in the fedora repos. Is there a more appropriate place for the flatpak files to live, rather than in the terminator repo?

Q 2 is more of a concern about the Profiles->Command Preferences pane. Can you put some indicator in there that the configuration options are not valid when you're running under flatpak.

Other than that, this looks really good.

@JayDoubleu
Copy link
Contributor Author

Hey, my understanding is that there is no need for Flatpak folder to be present within the repo itself at all. It's there only for testing or showcasing it working with flatpak-builder ( flathub native type of flatpak, not OCI )

Fedora flatpaks manage flatpaks via flatpaks/terminator on src.fedoraproject.org (or other repo can be created for this purpose. Fedora runtime flatpaks are OCI type thus use different tooling for building as well as use different manifest format )

If you want to publish to flathub that can be done separately by following their instructions (mainly the flatpak manifest is required for such submission, manifest from this PR could be used for this purpose)

Profiles->Command Preferences pane. Can you put some indicator in there that the configuration options are not valid when you're running under flatpak.

Would you be able to specify which options are no longer valid ? I was under impressed that functionality was working in latest commit (both running default shell as well as custom commands) or you're referring to things like -l flags ?

@JayDoubleu
Copy link
Contributor Author

@mattrose I've rebased and left out all the flatpak/flathub files out of this PR.

It now has only a single commit containing changes required for terminator to work within flatpaks in general. If this gets into a release then building out fedora OCI flatpak should just work.

I've moved the flatpak-builder manifest to my separate branch here: https://github.com/JayDoubleu/terminator/tree/flatpak_flathub_manifest

Comment on lines +418 to +419
if len(set([args[0], args[1]])) == 1:
del args[0]
Copy link
Contributor Author

@JayDoubleu JayDoubleu Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattrose
This will remove duplicated first command/shells which is caused by https://github.com/gnome-terminator/terminator/blob/master/terminatorlib/terminal.py#L1484 and to my understanding it's no longer needed when working with spawn_async() so it should be safe to do that.

@mattrose
Copy link
Member

mattrose commented Feb 6, 2022

This looks good, though I can't test the flatpak stuff atm. Is it safe to be merged in?

@JayDoubleu
Copy link
Contributor Author

JayDoubleu commented Feb 6, 2022

This looks good, though I can't test the flatpak stuff atm. Is it safe to be merged in?

I believe it is safe to be merged and should not affect any users who do not use flatpaks.
I've been using this build in flatpak as my daily driver and I had no issues with it so far so I guess it should be good for flathub.

Once merged and this version makes it's way to fedora I will be able to build and switch to fedora OCI flatpak full time and do some further testing.

I guess in both cases the changes would need to be made outside of this repository if there is any tweaks to be done.

PS there is no flatpak users as of yet unless someone had built it from these PRs.

Perhaps it's worth adding "Discussions" tab to this repo to discuss flatpaks further ?
I've compiled a small list of what to test for when testing flatpak etc

@JayDoubleu
Copy link
Contributor Author

@mattrose the https://github.com/JayDoubleu/terminator/tree/flatpak_flathub_manifest/experimental/flatpak is in line with this PR + flatpak manifest so in case if you would like to quickly test it on some Fedora VM or something you could use instructions from readme.

@JayDoubleu
Copy link
Contributor Author

hey @mattrose it's been a while.. do you think you'll find some time to look into this ?

@mattrose
Copy link
Member

mattrose commented Mar 3, 2022

Sorry, I've been really swamped lately but I hope to look at it soon.

@JayDoubleu
Copy link
Contributor Author

Thanks @mattrose I've been using it since as flatpak and had zero problems with it so far.
If this makes it into a release and then published to fedora or flathub it would be the first stable terminal emulator working as flatpak. I'm sure there is a lot of appetite for it in the community.

@mattrose
Copy link
Member

This is almost perfect, and definitely worth merging in.

I have one change I'd like to make, but I'll just merge this in and open an issue for the other change.

@mattrose mattrose merged commit 529d474 into gnome-terminator:master Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Snap and Flatpak for Terminator
2 participants