Hacker News new | ask | show | jobs
by exceptione 31 days ago

  > "Nerd Font icon scaling"
That would be a real improvement over Konsole.

  > "Additional optimizations for running efficiently when containerized (e.g. as a Flatpak)"
I never thought about running the terminal emulator itself in a bwrap session, but I am eager to learn what those optimizations entail.
2 comments

> I never thought about running the terminal emulator itself in a bwrap session, but I am eager to learn what those optimizations entail.

This is a pretty common scenario on immutable distros, and any power user who attempted to run a terminal emulator from a Flatpak would soon find out much of a pain it is. From what I recall, the main limitation is not having full access to the host processes, not having full access to the filesystem, and a few other Flatpak/bwrap induced restrictions.

Kwi solves the first problem by launching your shell directly on the host via D-bus, so the shell has full access to the host. Note that the terminal device itself still sits in the sandbox.

As for the file handling, it's mainly when you click on filesystem links, instead of going thru the xdg portal system like most portal apps, it again uses uses host execution method and calls `kde-open` to open the link via host's file handler, and furthermore, ensuring that the new window takes focus instead of remaining in the background (due to Wayland behaviour).

There's some other minor code around host process tracking and exit handling.

All of this makes the Flatpak version of the app behave like a native app (so don't rely on anything being actually sandboxed, if you're operating under that assumption).

Nothing too fancy honestly - Konsole inspects process metadata on the host via `flatpak-spawn`, which has a high overhead. Kwi makes D-Bus calls instead and saves a few processes/forks, and hence CPU. It's a fairly minor item on the list, all things considered.

There are some more ambitious approaches, like Ptyxis which runs an agent process on the host and talks to it over a socket pair, but I didn't want to invite that complexity just yet.

(Kwi author here.)