Package as a Flatpak, and decide where the agent runs #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Terminalko installs three binaries that work together:
terminalkoterminalko-agentterminalkoctlThe window starts the agent on demand (
crates/terminalko/src/link.rs,agent_program():TK_AGENT_PATH, else a binary beside the window, elsePATH)and talks to it over a unix socket in
$XDG_RUNTIME_DIR/terminalko/, passing ptydescriptors with
SCM_RIGHTS. Seedocs/spec/session-agent.md.An rpm exists and is verified (
build-aux/terminalko.spec);meson installworks. There is no Flatpak manifest.
The decision to make first
A session may be local, ssh, a container (podman, docker, toolbox,
distrobox) or root (sudo, run0, pkexec) — see
docs/spec/session-types.md.Inside a sandbox, none of the last three work usefully: there is no podman, no
toolbox, no polkit agent, and the user's ssh keys and agent are not there either.
So either:
(a) the agent runs on the host. The window stays sandboxed and starts the
agent with
flatpak-spawn --host, which needs--talk-name=org.freedesktop.Flatpak.Ptyxis does this — its
ptyxis-agentruns on the host — so the shape is proven.Consequences to work through:
$XDG_RUNTIME_DIRinside thesandbox is not the host's, so the path needs deciding (the host's real
runtime directory, exposed into the sandbox, or a path under
~/.var/app);something like
flatpak-spawn --host flatpak run --command=terminalko-agent me.dusansimic.terminalko, or the agent binary is exported to the host;TK_AGENT_PATHandTK_RUNTIME_DIR(both already supported) are probably howthis gets wired.
(b) the agent stays in the sandbox. Simple to package, and container, ssh and
root sessions become useless or misleading. If this is chosen, the session types
must be disabled in a sandboxed build rather than left to fail — a menu that
offers containers that cannot work is worse than one that does not offer them.
Option (a) is the useful one; option (b) is only worth it as a stopgap. Whichever
is chosen, write it down in
docs/spec/session-agent.md, which currently saysFlatpak is a later concern.
Work
build-aux/me.dusansimic.terminalko.yml(or.json) against a current GNOMEruntime, building with meson as the rpm does. The Rust dependencies need
handling: either a
cargo-sources.jsongenerated byflatpak-builder-tools/cargowith--no-networkbuilds, or vendoring.--socket=fallback-x11,--device=dri,--talk-name=org.freedesktop.Flatpakfor option (a),--talk-name=org.freedesktop.Notificationsfor exit notifications, andwhatever the socket path decision needs.
schemas are installed and validated inside the sandbox — the rpm build caught
that two relocatable schemas were missing from
meson install, so check.terminalkoctlon the host:flatpak run --command=terminalkoctlworks, butit needs the same socket path as the agent.
Acceptance criteria
flatpak-builderbuilds the manifest from a clean checkout and the result runs.the whole point of the agent, so it must hold inside a sandbox too.
(option b). Nothing may be offered and then fail because of the sandbox.
code path already tolerates that (it does: it checks whether anything owns
org.freedesktop.Notifications).docs/spec/session-agent.mdrecords which option was taken and why.Notes
flatpak-builderis not installed on the development machine as of writing;a manifest that has never been built is worth less than no manifest.
dynamically; a Flatpak must keep them as separate shared libraries rather
than statically merged, and ship their licence texts. See
CONTRIBUTING.md.