Add on-demand Flatpak compatibility tools

Add package-compatibility-helper --install <config-name> for command shims, MIME handlers, and binfmt interpreters. It installs the configured Flatpak on first use, then the shim runs the requested command through Flatpak. The command exits 0 only when the tool is installed, 1 when the user declines, cancels, or installation fails, and 2 for invalid usage or configuration.

CompatibilityToolInstaller combines compatibility-tool configuration discovery with Flatpak installation. Configs are read from /package-compatibility-helper/apps first, then the data directory, so downstreams can provide their own tools. A config describes the app, remote, optional post-install command, and supported MIME types. Installed-state detection checks both user and system Flatpak installations, including tools installed manually.

CompatibilityHelperFactory attaches a matching configured tool to native helpers and uses GenericCompatibilityHelper for otherwise unsupported configured MIME types. This replaces the hard-coded Wine installation handling with data/apps/wine.conf.

The GUI has a single QML entry point, Main.qml. In install-only mode it immediately presents InstallPage; file handling instead presents the normal compatibility-helper UI before offering installation. InstallPage supports size lookup, progress, cancellation, errors, and the correct standalone exit status.

CompatibilityToolInstaller uses libflatpak on a worker thread to add the configured remote when necessary, resolve download and installed sizes, and run a transaction pinned to that remote. A remote added for a declined installation is removed again. Post-install commands and desktop-service cache refreshes run after success.

Add integration trees for image builds. Tree command and binfmt shims call package-compatibility-helper-run, which checks the actual Flatpak ref before starting installation. The bundled kjar example supplies java, javac, and binfmt integration; its .jar MIME type is registered on Package Compatibility Helper’s desktop entry. new-tree.py also generates dedicated desktop MIME shims for downstream trees added at runtime.

Closes kde-linux#447 (closed) kde-linux#532

Signed-off-by: Hadi Chokr hadichokr@icloud.com

Edited by Thomas Duckworth

Merge request reports

Loading