Skip to content

feat(linux): package the desktop client for Flathub - #514

Open
plusmobileapps wants to merge 3 commits into
mainfrom
claude/linux-flathub-deployment-e4ff00
Open

feat(linux): package the desktop client for Flathub#514
plusmobileapps wants to merge 3 commits into
mainfrom
claude/linux-flathub-deployment-e4ff00

Conversation

@plusmobileapps

Copy link
Copy Markdown
Collaborator

Adds the Flatpak packaging for the Linux desktop client, plus the app-side fixes needed for it to actually work inside the sandbox.

What's here

packaging/linux/ — the four files that get committed to the Flathub repository, kept in this repo so they're reviewed and version-bumped alongside the code they package:

  • com.plusmobileapps.chefmate.yml — the manifest
  • com.plusmobileapps.chefmate.metainfo.xml — AppStream listing, OARS rating, releases
  • com.plusmobileapps.chefmate.desktop — desktop entry exported by the sandbox
  • chef-mate.sh — launcher shim at /app/bin/chef-mate

Sandbox fixes — each of these is a real breakage under Flatpak, not cosmetics:

Change Why
DriverFactory.jvm.kt honors XDG_DATA_HOME The hardcoded ~/.local/share/chef-mate isn't mounted in the sandbox. Same path outside Flatpak.
DesktopUpdater disabled under Flatpak Read-only install; Flathub owns updates. Same reasoning as the macOS/Windows store builds.
SchemeRegistrar skips self-registration It would write a handler pointing at a sandbox-internal launcher path the host can't run. The exported .desktop declares x-scheme-handler/chefmate instead.
main.kt pins awtAppClassName X11 otherwise derives WM_CLASS from the main class name, so the window doesn't match StartupWMClass and appears as a second unnamed dock entry.

platform/Flatpak.kt is the shared FLATPAK_ID / /.flatpak-info probe.

CIDesktop Release now stages chef-mate-<version>-linux-x86_64.tar.gz (jpackage app image with its bundled jlink runtime, hicolor icons resized from the 584x584 source, LICENSE) and attaches it to the GitHub Release. The .deb leg is unchanged.

Why it's not a source build

Flathub prefers manifests that compile in the build sandbox with no network. That isn't reachable here: every client/* module applies the Android Gradle plugin, so even the JVM target needs the Android SDK just to configure, and the SDK isn't redistributable so it can't be a Flatpak source. On top of that, an offline Gradle build would need every Maven artifact, the Gradle distribution, and the Kotlin compiler pinned as manifest sources.

So the manifest consumes the upstream-built tarball — the same shape Flathub accepts for other large JVM apps (IntelliJ IDEA Community is Apache-2.0 and still ships an upstream tarball). Reviewers may well push on this; the rationale is written up in packaging/linux/README.md.

Runtime choices

  • org.gnome.Platform//50, not Freedesktop — JavaFX (the in-app recipe browser's WebView) links against GTK 3, which the Freedesktop runtime doesn't ship.
  • Plain --socket=x11, not fallback-x11 — Compose Desktop renders through AWT/Skiko and JavaFX through GTK; neither has a Wayland backend, so both need XWayland even in a Wayland session. The shim pins GDK_BACKEND=x11.
  • --filesystem=xdg-pictures/documents/download — the pickers are java.awt.FileDialog, which browses the sandbox filesystem directly and never reaches the document portal.

Reviewer notes

  • The flatpak build is untested. flatpak-builder needs Linux and this was authored on macOS. JVM compile passes and ktfmt is clean, but the manifest, the WM_CLASS value, and the app-image directory name the CI step globs for are unverified against a real build.
  • Two hard blockers remain before submission, both listed in the packaging README: the screenshots referenced by the metainfo don't exist yet, and the manifest's sha256 is a placeholder until a release publishes the tarball.
  • Flathub's generative AI policy applies to the app, the manifest, the PR, and the review replies — worth reading before opening anything against flathub/flathub.
  • Nothing in this repo pushes to Flathub. Once submitted, x-checker-data drives version bumps via Flathub's external-data-checker.

🤖 Generated with Claude Code

plusmobileapps and others added 3 commits July 31, 2026 07:22
Four behaviors the desktop app owns on a normal Linux install belong to the
sandbox (or are outright broken by it) in a Flatpak build:

- The database directory hardcoded ~/.local/share/chef-mate, which the sandbox
  does not mount. Honor XDG_DATA_HOME, which Flatpak points at the app's private
  ~/.var/app/<id>/data. Outside a sandbox the two resolve to the same path.
- The in-app updater downloads a .deb and runs it. The sandbox is read-only and
  Flathub publishes updates, so disable it there for the same reason it is
  already disabled on the two app-store platforms.
- SchemeRegistrar self-registers chefmate:// by writing a handler .desktop file.
  Inside the sandbox that points at a sandbox-internal launcher path the host
  session cannot run; the exported .desktop declares the scheme instead.
- X11 derived WM_CLASS from the main class name, so the window would not match
  the .desktop file's StartupWMClass and showed up as a second unnamed dock
  entry. Pin awtAppClassName to the app id before AWT initializes.

Adds platform/Flatpak.kt as the shared FLATPAK_ID / /.flatpak-info probe.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Flatpak manifest, AppStream metainfo, desktop entry, and launcher shim that
get committed to the Flathub repository. They live here so they are reviewed and
version-bumped alongside the code they package.

The manifest consumes a jpackage app image tarball rather than building from
source: every client/* module applies the Android Gradle plugin, so even the JVM
target needs the Android SDK to configure, and the SDK cannot be a Flatpak
source. Desktop Release now stages that tarball (app image with its bundled jlink
runtime, hicolor icon sizes resized from the 584x584 source, and the license) and
attaches it to the GitHub Release, where x-checker-data picks it up.

Runtime choices worth noting: org.gnome.Platform because JavaFX links against
GTK 3, plain --socket=x11 because neither AWT/Skiko nor JavaFX has a Wayland
backend, and xdg-pictures/documents/download because the file pickers are
java.awt.FileDialog and never reach the document portal.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
packaging/linux/README.md covers building and linting the flatpak locally, the
pre-submission checklist (screenshots and the tarball sha256 are still open), the
submission flow against flathub/flathub's new-pr branch, and why the manifest is
not a source build. Cross-linked from the deployment guide next to the Windows
and macOS store sections.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant