apps/web/content/docs/developers/11.distribution.mdx
This document describes how to build Char as a Flatpak and submit it to Flathub.
Char uses the "build from source" strategy for Flatpak packaging, which is the preferred approach for Flathub. This means the entire application is built inside the Flatpak sandbox using vendored dependencies.
Install the required tools:
# Install Flatpak and flatpak-builder
sudo apt install flatpak flatpak-builder
# Add Flathub repository
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# Install GNOME runtime and SDK
flatpak install flathub org.gnome.Platform//47 org.gnome.Sdk//47
# Install SDK extensions for Rust and Node
flatpak install flathub org.freedesktop.Sdk.Extension.rust-stable//24.08
flatpak install flathub org.freedesktop.Sdk.Extension.node22//24.08
Install the flatpak-builder-tools for generating vendored dependencies:
# Clone flatpak-builder-tools
git clone https://github.com/nickvidal/flatpak-builder-tools.git
# For Node/pnpm dependencies
pip install aiohttp toml
# For Cargo dependencies
pip install toml
Before building the Flatpak, you need to generate JSON files containing all vendored dependencies. These files allow the build to proceed offline, which is required by Flathub.
From the repository root:
# Generate pnpm-sources.json
python3 flatpak-builder-tools/node/flatpak-node-generator.py pnpm \
-o apps/desktop/flatpak/pnpm-sources.json \
pnpm-lock.yaml
From the repository root:
# Generate cargo-sources.json
python3 flatpak-builder-tools/cargo/flatpak-cargo-generator.py \
-d Cargo.lock \
-o apps/desktop/flatpak/cargo-sources.json
Once the vendored dependency files are generated, you can build the Flatpak locally:
# Build and install to user Flatpak
flatpak-builder --user --install --force-clean \
flatpak-build-dir \
apps/desktop/flatpak/com.hyprnote.Char.yml
After building and installing:
flatpak run com.hyprnote.Char
To debug inside the Flatpak sandbox:
# Open a shell inside the sandbox
flatpak run --devel --command=sh com.hyprnote.Char
# Inside the sandbox, you can inspect /app and run the binary directly
ls /app/bin/
/app/bin/hyprnote
Before submitting to Flathub, ensure:
flatpak-builderflatpak run com.hyprnote.CharFork the flathub/flathub repository on GitHub
Clone your fork and checkout the new-pr branch:
git clone --branch=new-pr [email protected]:YOUR_USERNAME/flathub.git
cd flathub
Create a new branch for your app:
git checkout -b com.hyprnote.Char
Create the app directory and copy files:
mkdir com.hyprnote.Char
cp /path/to/hyprnote/apps/desktop/flatpak/com.hyprnote.Char.yml com.hyprnote.Char/
cp /path/to/hyprnote/apps/desktop/flatpak/com.hyprnote.Char.desktop com.hyprnote.Char/
cp /path/to/hyprnote/apps/desktop/flatpak/com.hyprnote.Char.metainfo.xml com.hyprnote.Char/
cp /path/to/hyprnote/apps/desktop/flatpak/pnpm-sources.json com.hyprnote.Char/
cp /path/to/hyprnote/apps/desktop/flatpak/cargo-sources.json com.hyprnote.Char/
Update the manifest to use a git source instead of a local directory:
sources:
- type: git
url: https://github.com/fastrepl/char.git
tag: desktop_vX.Y.Z # Use the release tag
commit: abc123... # Include the commit hash
Commit and push:
git add .
git commit -m "Add com.hyprnote.Char"
git push origin com.hyprnote.Char
Open a pull request from your branch to the new-pr branch of flathub/flathub
Respond to review comments from Flathub maintainers
Once approved:
flathub/com.hyprnote.CharWhen releasing a new version:
com.hyprnote.Char.metainfo.xmlapps/desktop/
flatpak/
com.hyprnote.Char.yml # Flatpak manifest
com.hyprnote.Char.desktop # Desktop entry file
com.hyprnote.Char.metainfo.xml # AppStream metadata
pnpm-sources.json # Vendored pnpm dependencies (generated)
cargo-sources.json # Vendored Cargo dependencies (generated)
src-tauri/
tauri.conf.flatpak.json # Tauri config for Flatpak (updater disabled)
The Flatpak manifest includes the following permissions:
Regenerate the vendored dependency files:
python3 flatpak-builder-tools/node/flatpak-node-generator.py pnpm -o apps/desktop/flatpak/pnpm-sources.json pnpm-lock.yaml
python3 flatpak-builder-tools/cargo/flatpak-cargo-generator.py -d Cargo.lock -o apps/desktop/flatpak/cargo-sources.json
Ensure PulseAudio is running on your system. The Flatpak uses --socket=pulseaudio for audio access.
Some desktop environments require additional configuration for StatusNotifier support. The manifest includes --talk-name=org.kde.StatusNotifierWatcher for tray icon support.