Repository navigation
feat(flatpak): in-app updates through the Flatpak portal - #898
Merged
Merged
Conversation
New `flatpak` module, the Flathub counterpart of MicrosoftStore.updates, over org.freedesktop.portal.Flatpak (Rust JNI bridge on zbus): - `status`: the portal's update monitor, as Available / Installed / UpToDate. The portal has no "check now" (it polls every 30 min), so this is a Flow, not a check() - `install`: UpdateMonitor.Update with progress; the first one shows the portal's "Update <app>?" dialog over the parent window - `restart`: hands the single-instance lock over and Spawns the latest commit, then exits - `openStorePage`: appstream://<app id> through the OpenURI portal Spawn is always given fds 0-2: without any, the portal hands the environment to `flatpak run` on fd 0, which it rejects, and nothing starts after the app already quit. The Lab's system.flatpak-updates probe drives it, deep-link flags included (?watch&install&restart). Verified end to end from a local Flatpak repository: detection, the dialog, install, restart after an in-app and after a background update.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New
flatpakmodule (nucleus.flatpak), the Flathub counterpart ofMicrosoftStore.updates, overorg.freedesktop.portal.Flatpak(Rust JNI bridge on zbus, Linux only, Kotlin-onlyUnsupportedelsewhere).status: Flow<FlatpakUpdateStatus>(Available/Installed/UpToDate)CreateUpdateMonitor+UpdateAvailableinstall(parent): Flow<FlatpakUpdateProgress>UpdateMonitor.Update+Progressrestart(arguments)SingleInstanceManager.releaseForHandoff(), thenSpawnwithFLATPAK_SPAWN_FLAGS_LATEST_VERSION, then exitopenStorePage(parent)appstream://<app id>Design notes (from the portal's source)
statusis aFlow, not acheck().Updateshows "Update ?". The answer is stored (permission tableflatpak, idupdates), and a refusal maps toUpdateDenied.NotSupportedraised while planning meansNewPermissionsRequired; raised before planning, it meansPortalMissing.installcollection interrupts it.Spawnis always given fds 0–2. Without any, the portal hands the environment toflatpak runon fd 0, which rejects it (--env-fd: Cannot use reserved file descriptor 0, 1 or 2), and nothing starts after the app already quit.flatpak-spawnalways passes its stdio, which is why this isn't widely known.Lab
The new
system.flatpak-updatesprobe (Linux) supports deep-link flags?watch&install&restart, which run the whole update without a click.Verification
End to end, from a local Flatpak repository with the real
flatpak-portal(polled every 10 s) and the Lab as a native image:status 2.flatpak update(1.0.5 → 1.0.6): a single instance came back on the new commit.:flatpak:check(19 tests, detekt, ktlint),apiCheck,:examples:lab:probes:system:check,cargo clippywith 0 warnings.Checked by hand on Ubuntu GNOME (Lab 1.0.8, Wayland): the dialog opens attached to the Lab window, "Deny" fails
install()withUpdateDenied, andopenStorePageopens GNOME Software.CI: one build step and the verify entries in
build-natives.yaml, plus the 2 Linux paths inpublish-maven.yaml.