Flatpak STF: Terminal Intent

I’ve been working for a while as a contractor as part of the Sovereign Tech Fund (STF) initiative for Flatpak, organized by Modal and Para-Real Ltd. There is a nice write up about the project, giving an overview of the investment and the collaborative effort.

Intents

My involvement has been focused on the Intents, which is an abstract system for apps to declare their offered services. Applications can announce which Intents they support using the Implements key from the Desktop Entry specification, and the default selection mechanism is solved by the intent-apps specification. For example, one could develop a Thumbnailer Intent, which would be then supported by implementing a specific DBus interface (e.g. “org.freedesktop.Thumbnailer1”). That would allow for apps and system components to have a standardized, flatpak friendly way to discover thumbnailers, and use their functionality in the sandboxed world, increasing security. Another use case would be an URI Handler Intent, that would among others let users specify which applications they would like to be opened when clicking a particular link. The overall idea has been going for quite a while, and there are some very good sources to read up on the Intents in general, including Andy Holmes’ “Best Intentions” blog post and Sebastian Wick’s follow up.

Terminal Intent

Last year the intent-apps specification allowing for default selection of Intents was accepted, and the next step is to start implementing them. One that caught interest is the Terminal Intent. Currently, there is no standardized, sandbox friendly way for the system to discover terminal emulators, and use their functionality. It’s not associated with either a mime-type or an URI scheme, which is one of the reasons why changing the default terminal has been challenging for a long time now.

This changes with the proposed spec, that allows applications to implement the “org.freedesktop.Terminal1” Intent, and therefore advertise to the system and other interested users that it’s a terminal emulator, capable of executing commands via a specific D-Bus interface. In GNOME, it will unlock many things we’ve wanted for quite a while, among others: changing the default terminal in Settings, adjusting the behaviour when launching apps meant for terminal, and opening directories from the file manager.

Settings

There’s an early implementation in GNOME Settings for the terminal Intent, that exposes an option to change the default terminal emulator across the system. Applications that are meant to be executed in a terminal window, which is indicated by a “Terminal=true” line in their desktop file, would then launch in the previously selected terminal. Apart from the spec being accepted itself, for the functionality to work correctly, there needs to be support for the intent in GLib, which is being worked on, as well as in the terminal emulators themselves, with both Console and Ptyxis having work in progress implementations.

Settings with an option to choose the default terminal

Below I’ve provided screen recordings of Shell launching Vim in a terminal emulator chosen in Settings, as well as a custom terminal application.

Files

Another cool use case would be opening directories from the file manager in the terminal, adhering to the selected default in Settings. The integration would also cover other terminal related functionality, such as running the scripts as programs in the terminal. There’s a work in progress implementation in GNOME Files.

Here’s another pair of screen recordings, showing Files opening directories and running a custom script in a terminal emulator chosen in Settings.

Testing

As usual, I’ve prepared a custom GNOME OS image that can be used to test the functionality, which I’ve also used to make various screenshots and recordings in this blog post. You’ll need to install it (in GNOME Boxes for example), which takes a simple click and does not require a reboot (magic!). To be able to switch between different default terminals, you’ll want to download the custom build of Ptyxis as well, and install it with a command “flatpak install ptyxis-terminal-intent.flatpak”. Then you can get some applications meant for terminal such as Vim directly in Software, which is preconfigured to get them from Flathub.

Next

Currently, the major blocker for the work is getting the Terminal Intent specification accepted upstream, which needs to be merged before the rest of the ecosystem can fully embrace it. There needs to be consensus from other desktops such as KDE, after which the focus would become the GLib integration, following support from individual applications. And in the future, work on other Intents can begin, unlocking many more possibilities.

I’d like to thank Modal and Para-Real Ltd. for the ability to work on this, as well as Sovereign Tech Agency for sponsoring the work. I also really appreciate the help from the technical leads Sebastian Wick and Adrian Vovk who are always there to answer questions, the organization of the work by Kateryna Omeltschenko who knows how to brighten up a meeting, and Cade Diehm, who’s bravely fighting with the bureaucracy for us. 😉 Until the next update!

Avatar of Carlos Garnacho

Carlos Garnacho

@garnacho

On mobile and peer pressure

Guadec happened. It was a extremely well organized event, with plenty of good talk, people that I was longing to see again, and new faces to put a name on.

My experience was however very much soured by interactions with other people within the community, against myself and other members of the community. To the point that I had to take the time to relieve the distress it has caused me, hence the time it took me to write this down.

The mobile shell initiative

The development for a “mobile” GNOME Shell started somewhere around 2022, and at least the supporting parts of it passed as a project sponsored by the first and only round of GNOME projects sponsored by Germany’s Sovereign Tech Fund, as “Increase Range and Quality of Hardware Support”, this was acknowledged in the final STF report.

Making GNOME Shell behave natively on a new form factor is a massive undertaking, and the planning was not sufficient. The first, most glaring mistake was to drive this project from the start with minimal involvement from the existing project maintainers. No consultation happened at any point in planning, not just to ensure the goals were in scope, but also to ensure the project is stewarded towards a point that everyone can walk away with a sense of completion.

The second biggest mistake was in planning for upstreaming, instead the work piled up on a branch in a personal repository.

To be fair, the supporting bits got merged over time, and there’s got to be some breathing room for new initiatives. But sooner or later there’s the harsh reality that the work has to be divided into tractable pieces and pushed in a structured manner through the review process, in order to end up with the work merged upstream.

The Mutter low level pieces were merged over the course of 1 year after the STF project, divided in 3 (1 2 3) merge requests, and some of the corresponding GNOME Shell changes to make use of this (no longer) new infrastructure were merged as well.

But meanwhile the mobile-shell branch kept piling on, north of 300 patches, with substantial changes to code (diff is +120437 -7156, by my accounting) and UI. The original author did not make attempts to upstream the changes, and the few efforts from other participants to upstream bits of it or as a whole did not last long, unfortunately. The work is nowadays sitting on its separate repository, using a separate issue tracker.

The mobile BoF at Guadec

This jagged interaction between the people acting as maintainers and the people driving the mobile-shell initiative lead to difficulties in making this work upstreamed in a timely fashion, much to everyone’s disappointment. In this situation, we arrive to this year’s Guadec. There is of course an interest in upstreaming the changes, from Mutter+Shell core developers and maintainers included, so we attend this BoF.

What happened there could be best described as a maintainer shaming session, specifically towards Jonas Adahl, Florian Müllner and myself, for “discriminating/demotivating newcomers”, “wanting to steal the spotlight”, “stalling things on purpose”, … essentially choosing slander as a way to put the blame on us for not having merged the work as-is. Even though this attack was driven by a few closely related to the initiative, it happened in front of 20+ people.

This was not ok

Even though I understand the frustration behind, I find the tactics used on us inexcusable.

Look, the community guidelines at conduct.gnome.org are a bar to meet for everyone, towards everyone. And the guiding principle of them all is pretty simple, we all row the boat roughly in the same direction. Once the basic principles of respect are lost between us, the boat does sink. The main asset that keeps Free Software moving forward is not the code, but the people.

Jonas, Florian and myself are lucky to be paid by our employer to work upstream on GNOME, but I can say for myself (and perhaps the three of us) that I work at Red Hat because I work on GNOME, rather than the other way around. We go well beyond our duties, in ways our employer does not care in the slightest if we do, and in ways it consumes our free time as well. We have looked to nurture the community, mentoring in GSoC and Outreachy more times than it’s worth counting. The accusations of discrimination fall entirely flat.

We so far had no trouble in collaborating with the main developer behind the mobile shell work either, there’s 226 merge requests merged from him in GNOME Shell and 151 in Mutter attesting that.

This strain on relationships is not baggage free. I don’t see myself working with the individuals that drove this attack pretty much anymore with any productive outcomes, and I will avoid that to the extent of my capabilities. There is an unbelievably long road to undo the damage they’ve done.

How to improve from here

The mobile fork is currently sitting in a separate repository, based on a now old release, and contains a number of back-and-forths, FIXMEs, WIPs, and code that has been either already done (albeit differently) or entirely refurbished upstream.

A rebase that is mindful to all these and brings the branch to a plausible up-to-date state is likely to take days to weeks. At this point, it could make more sense to identify the possible topics to split into multiple (many) merge requests, and cherry-pick the patches individually.

After these merge requests are done, they should go through review, and the style/architectural differences between the original author and the maintainers’ mindset be settled. Changes could be merged incrementally, advancing towards the common end goal.

It looks like I just described the software review process in a nutshell, and I very much did! But I feel it is important to point out that nothing of this has happened yet with these patches in a proper or substantial way.

In a shred of constructivism during the Mobile BoF, Markus Göllnitz offered himself to do this on behalf of the original author. I am looking forward for these steps to happen, and will collaborate with Markus on it.

I deep down hope that this blog post also serves as a cautionary tale about how wanting to rock the boat instead of rowing together may stall initiatives, and eventually poison relationships.