# Flatpak build assets

## Files

| File | Purpose |
|---|---|
| `com.unifiedretail.ZebraBrowserPrint.json` | The manifest. Driven by `flatpak-builder`. |
| `cargo-sources.json` | 357 entries — every transitive Rust crate, pre-vendored as `archive` sources with sha256, so the build runs offline (Flathub policy). Generated; don't hand-edit. |

## Regenerating cargo-sources.json

After changing `Cargo.toml` or `Cargo.lock`, regenerate:

```bash
python3 build-aux/flatpak-cargo-generator.py Cargo.lock \
        -o build-aux/flatpak/cargo-sources.json
```

The generator script lives at `build-aux/flatpak-cargo-generator.py`,
fetched from upstream
[flatpak/flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools/tree/master/cargo).

## What the finish-args do

| Argument | Why |
|---|---|
| `--share=ipc --socket=fallback-x11 --socket=wayland --device=dri` | Standard GTK app rendering. The `fallback-x11` line keeps it working on XWayland sessions where Wayland support breaks. |
| `--talk-name=com.unifiedretail.ZebraBrowserPrint` | Allows the UI to call the Go agent's D-Bus interface (the whole point of the app). |
| `--talk-name=org.kde.StatusNotifierWatcher` + `--own-name=org.kde.StatusNotifierItem-*` | Required for the `ksni` tray indicator to register. |
| `--talk-name=org.freedesktop.systemd1` + `--system-talk-name=org.freedesktop.systemd1.Manager` | The autostart toggle shells out to `systemctl --user enable/disable`. Without these, the sandbox blocks the call. |
| `--talk-name=org.freedesktop.portal.OpenURI` | Used when the user clicks the project link in the metainfo footer; goes through xdg-desktop-portal so URLs open in their default browser, not inside the sandbox. |

## Test build

```bash
flatpak-builder --user --install --force-clean build \
    build-aux/flatpak/com.unifiedretail.ZebraBrowserPrint.json
flatpak run com.unifiedretail.ZebraBrowserPrint
```

## Submission checklist (Flathub)

- [ ] Replace `branch: main` in the manifest with a tagged release ref
- [ ] Confirm `cargo-sources.json` matches the tagged commit's `Cargo.lock`
- [ ] `appstreamcli validate --no-net data/com.unifiedretail.ZebraBrowserPrint.metainfo.xml`
- [ ] `desktop-file-validate data/com.unifiedretail.ZebraBrowserPrint.desktop`
- [ ] Linter run: `flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest com.unifiedretail.ZebraBrowserPrint.json`
- [ ] At least 2 screenshots hosted at stable URLs (referenced in the metainfo)
- [ ] Submit PR to https://github.com/flathub/flathub
