Featuring more powerful key and mouse bindings, new lua functions for
diff --git a/ci/flatpak-build.sh b/ci/flatpak-build.sh
new file mode 100755
index 000000000..1261a0555
--- /dev/null
+++ b/ci/flatpak-build.sh
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+set -xeu
+
+if ! [[ -f Cargo.lock ]]; then
+ >&2 echo "ERROR: This script should be called from repo root!"
+ exit 1
+fi
+
+# Add flathub repo if not available
+flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
+
+# Install SDK & Platform flatpak components
+# NOTE: We install specific version of those components, make sure it corresponds with the
+# runtime-version used in ../assets/flatpak/org.wezfurlong.wezterm.LOCAL-TESTING.json
+flatpak install --user --noninteractive flathub \
+ org.freedesktop.Platform//23.08 \
+ org.freedesktop.Sdk//23.08 \
+ org.freedesktop.Sdk.Extension.rust-stable//23.08
+
+# Disabled for now: seems like it has an OpenSSL problem and fails to use SSL when
+# validating the screenshot URLs
+#flatpak install --user --noninteractive org.freedesktop.appstream-glib
+#flatpak run --env=G_DEBUG=fatal-criticals org.freedesktop.appstream-glib validate assets/wezterm.appdata.xml
+
+# Generate list of cargo dependencies for the isolated flatpak build
+if command -v flatpak-cargo-generator &>/dev/null; then
+ fcg_bin=(flatpak-cargo-generator)
+else
+ python3 -m pip install toml aiohttp
+ curl -L 'https://github.com/flatpak/flatpak-builder-tools/raw/master/cargo/flatpak-cargo-generator.py' > /tmp/flatpak-cargo-generator.py
+ fcg_bin=(python3 /tmp/flatpak-cargo-generator.py)
+fi
+"${fcg_bin[@]}" Cargo.lock -o assets/flatpak/generated-sources.json
+
+# Build & install the flatpak locally
+# NOTE: Disabled in CI
+if [ "${CI:-}" != "yes" ] ; then
+ flatpak-builder \
+ --state-dir /var/tmp/wezterm-flatpak-builder \
+ --install /var/tmp/wezterm-flatpak-repo \
+ assets/flatpak/org.wezfurlong.wezterm.LOCAL-TESTING.json \
+ --user --force-clean -y
+fi
diff --git a/ci/flatpak.sh b/ci/flatpak.sh
deleted file mode 100755
index 2d84f4c83..000000000
--- a/ci/flatpak.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-set -xe
-
-flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
-flatpak install --noninteractive --user flathub org.freedesktop.Platform//23.08 org.freedesktop.Sdk//23.08 org.freedesktop.Sdk.Extension.rust-stable//23.08
-
-flatpak install --noninteractive --user org.freedesktop.appstream-glib
-
-# Disabled for now: seems like it has an OpenSSL problem and fails to use SSL when
-# validating the screenshot URLs
-#flatpak run --env=G_DEBUG=fatal-criticals org.freedesktop.appstream-glib validate assets/wezterm.appdata.xml
-
-python3 -m pip install toml aiohttp
-curl -L 'https://github.com/flatpak/flatpak-builder-tools/raw/master/cargo/flatpak-cargo-generator.py' > /tmp/flatpak-cargo-generator.py
-python3 /tmp/flatpak-cargo-generator.py Cargo.lock -o assets/flatpak/generated-sources.json
-
-if [ "${CI}" != "yes" ] ; then
- flatpak-builder \
- --state-dir /var/tmp/wezterm-flatpak-builder \
- --install /var/tmp/wezterm-flatpak-repo \
- assets/flatpak/org.wezfurlong.wezterm.json \
- --force-clean --user -y
-fi
diff --git a/ci/make-flathub-pr.sh b/ci/make-flathub-pr.sh
index 1ad03db79..0089c674b 100755
--- a/ci/make-flathub-pr.sh
+++ b/ci/make-flathub-pr.sh
@@ -1,10 +1,22 @@
-#!/bin/bash
-set -xe
+#!/usr/bin/env bash
+set -xeu
+
+if ! [[ -f Cargo.lock ]]; then
+ >&2 echo "ERROR: This script should be called from repo root!"
+ exit 1
+fi
+
TAG_NAME=$(ci/tag-name.sh)
-python3 -m pip install toml aiohttp
-curl -L 'https://github.com/flatpak/flatpak-builder-tools/raw/master/cargo/flatpak-cargo-generator.py' > /tmp/flatpak-cargo-generator.py
-python3 /tmp/flatpak-cargo-generator.py Cargo.lock -o flathub/generated-sources.json
+# Generate list of cargo dependencies for the isolated flatpak build
+if command -v flatpak-cargo-generator &>/dev/null; then
+ fcg_bin=(flatpak-cargo-generator)
+else
+ python3 -m pip install toml aiohttp
+ curl -L 'https://github.com/flatpak/flatpak-builder-tools/raw/master/cargo/flatpak-cargo-generator.py' > /tmp/flatpak-cargo-generator.py
+ fcg_bin=(python3 /tmp/flatpak-cargo-generator.py)
+fi
+"${fcg_bin[@]}" Cargo.lock -o assets/flatpak/generated-sources.json
URL="https://github.com/wezterm/wezterm/releases/download/${TAG_NAME}/wezterm-${TAG_NAME}-src.tar.gz"
@@ -12,10 +24,10 @@ URL="https://github.com/wezterm/wezterm/releases/download/${TAG_NAME}/wezterm-${
# in the current dir. This is handled by actions/download-artifact in CI
SHA256=$(sha256sum wezterm*-src.tar.gz | cut -d' ' -f1)
-sed -e "s,@URL@,$URL,g" -e "s/@SHA256@/$SHA256/g" < assets/flatpak/org.wezfurlong.wezterm.template.json > flathub/org.wezfurlong.wezterm.json
+sed -e "s,@URL@,$URL,g" -e "s/@SHA256@/$SHA256/g" < assets/flatpak/org.wezfurlong.wezterm.RELEASE-TEMPLATE.json > flathub/org.wezfurlong.wezterm.json
RELEASE_DATE=$(git -c "core.abbrev=8" show -s "--format=%cd" "--date=format:%Y-%m-%d")
-sed -e "s,@TAG_NAME@,$TAG_NAME,g" -e "s/@DATE@/$RELEASE_DATE/g" < assets/flatpak/org.wezfurlong.wezterm.appdata.template.xml > flathub/org.wezfurlong.wezterm.appdata.xml
+sed -e "s,@TAG_NAME@,$TAG_NAME,g" -e "s/@DATE@/$RELEASE_DATE/g" < assets/flatpak/org.wezfurlong.wezterm.appdata.RELEASE-TEMPLATE.xml > flathub/org.wezfurlong.wezterm.appdata.xml
cd flathub
git config user.email wez@wezfurlong.org
diff --git a/docs-internal/flatpak-distribution.md b/docs-internal/flatpak-distribution.md
new file mode 100644
index 000000000..68e102023
--- /dev/null
+++ b/docs-internal/flatpak-distribution.md
@@ -0,0 +1,36 @@
+# Flatpak distribution
+
+## Release build
+
+For a release build, the flatpak definition is
+`assets/flatpak/org.wezfurlong.wezterm.RELEASE-TEMPLATE.json` with metadata in
+`assets/flatpak/org.wezfurlong.wezterm.appdata.RELEASE-TEMPLATE.xml`.
+
+A GHA workflow runs the `ci/flathub-prepare-pr.sh` script from repo root to prepare a few metadata
+files, followed by opening a PR on the [flathub repo][flathub-repo] for the new version.
+
+Once merged, flathub builders will auto-schedule the actual build for later inclusion in the flathub
+app catalog. This can be followed on