Files
qbz/packaging/flatpak/com.blitzfc.qbz.yml
T
vicrodh e2e4fb8cab feat(discord-rpc): lazy Flatpak socket bridge keeps the integration opt-in
Discord-Flatpak writes its IPC socket to
\$XDG_RUNTIME_DIR/app/com.discordapp.Discord/discord-ipc-N rather than
the \$XDG_RUNTIME_DIR/discord-ipc-N path the discord-rich-presence crate
searches by default. The naive way to bridge that gap — a startup
wrapper that unconditionally symlinks every iteration before the binary
launches — works, but it pulls the integration off-script: every other
optional integration in QBZ (Last.fm, ListenBrainz, MusicBrainz, Plex)
is opt-in, with zero telemetry and zero filesystem reach until the user
flips the toggle. A startup wrapper would silently turn Discord RPC
into opt-out at the sandbox layer; the symlinks would exist for users
who never touched the integrations panel.

Move the bridge into the lazy connect path instead. The first time the
user actually connects — i.e. the first track plays after they enabled
the toggle — prepare_flatpak_discord_socket_links runs:

* No-op outside Flatpak (no FLATPAK_ID env var)
* No-op when \$XDG_RUNTIME_DIR/discord-ipc-N already exists (native
  Discord, or a previous lazy run in this Flatpak instance)
* No-op when the Discord-Flatpak source path doesn't exist (Discord
  not running)
* Otherwise, symlinks 0..9 from \$XDG_RUNTIME_DIR/discord-ipc-N to
  \$XDG_RUNTIME_DIR/app/com.discordapp.Discord/discord-ipc-N

Symlinks die with the Flatpak instance — \$XDG_RUNTIME_DIR is per-
instance, so there's no cross-session pollution. Users who never enable
Discord RPC keep the same sandbox surface as before.

Manifest: keep the static xdg-run/discord-ipc-0 permission for native
Discord, add xdg-run/app/com.discordapp.Discord:create so the lazy
symlink path is allowed when the user opts in. The two coexist; the
crate's default search path covers Discord-native, the symlinks cover
Discord-Flatpak.

cc
2026-05-09 12:38:25 -06:00

185 lines
6.6 KiB
YAML

app-id: com.blitzfc.qbz
runtime: org.gnome.Platform
runtime-version: '49'
sdk: org.gnome.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.node24
- org.freedesktop.Sdk.Extension.rust-stable
- org.freedesktop.Sdk.Extension.llvm20
command: qbz
finish-args:
- --share=ipc
- --share=network
- --socket=wayland
- --socket=fallback-x11
- --socket=pulseaudio
- --device=dri
# Native PipeWire access
- --filesystem=xdg-run/pipewire-0:ro
# Discord IPC socket for Rich Presence (#336).
# - The static path covers Discord installed natively (deb / rpm / AUR
# builds), which write the socket directly under $XDG_RUNTIME_DIR.
# - The :create permission on the Discord-Flatpak app dir lets us read
# the socket created by Discord-via-Flathub AND lay down our own
# $XDG_RUNTIME_DIR/discord-ipc-{0..9} symlinks pointing at it. The
# crate `discord-rich-presence` only knows the static path; the
# symlinks are what bridge the two sandboxes. See discord_rpc.rs:
# prepare_flatpak_discord_socket_links — called only after the user
# opts in via the settings toggle, so users who never enable Discord
# RPC never touch this dir.
- --filesystem=xdg-run/discord-ipc-0
- --filesystem=xdg-run/app/com.discordapp.Discord:create
# User music library
- --filesystem=xdg-music
# Required for tray icon visibility in Flatpak sandbox
- --filesystem=xdg-run/tray-icon:create
# Notifications and tray
- --talk-name=org.freedesktop.Notifications
- --talk-name=org.kde.StatusNotifierWatcher
# System keyring (GNOME Keyring, KDE Wallet) for credential storage
- --talk-name=org.freedesktop.secrets
# MPRIS media controls (own-name auto-granted: name contains appid)
- --talk-name=org.mpris.MediaPlayer2.*
modules:
# intltool required for libdbusmenu
- name: intltool
buildsystem: autotools
cleanup:
- '*'
sources:
- type: archive
url: https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz
sha256: 67c74d94196b153b774ab9f89b2fa6c6ba79352407037c8c14d5aeb334e959cd
# Dependency for libayatana-appindicator
- name: libdbusmenu
buildsystem: autotools
build-options:
cflags: -Wno-error
env:
HAVE_VALGRIND_FALSE: '#'
HAVE_VALGRIND_TRUE: ''
config-opts:
- --with-gtk=3
- --disable-dumper
- --disable-static
- --disable-gtk-doc
- --enable-introspection=no
- --disable-vala
cleanup:
- /include
- /lib/pkgconfig
- /lib/*.la
- /share/doc
- /share/libdbusmenu
sources:
- type: archive
url: https://launchpad.net/libdbusmenu/16.04/16.04.0/+download/libdbusmenu-16.04.0.tar.gz
sha256: b9cc4a2acd74509435892823607d966d424bd9ad5d0b00938f27240a1bfa878a
- name: ayatana-ido
buildsystem: cmake-ninja
config-opts:
- -DENABLE_TESTS=NO
- -DCMAKE_INSTALL_LIBDIR=lib
cleanup:
- /include
sources:
- type: archive
url: https://github.com/AyatanaIndicators/ayatana-ido/archive/refs/tags/0.10.4.tar.gz
sha256: bd59abd5f1314e411d0d55ce3643e91cef633271f58126be529de5fb71c5ab38
- name: libayatana-indicator
buildsystem: cmake-ninja
config-opts:
- -DENABLE_TESTS=NO
- -DENABLE_IDO=YES
- -DENABLE_LOADER=NO
- -DCMAKE_INSTALL_LIBDIR=lib
cleanup:
- /include
- /lib/pkgconfig
- /share
sources:
- type: archive
url: https://github.com/AyatanaIndicators/libayatana-indicator/archive/refs/tags/0.9.4.tar.gz
sha256: a18d3c682e29afd77db24366f8475b26bda22b0e16ff569a2ec71cd6eb4eac95
- name: libayatana-appindicator
buildsystem: cmake-ninja
config-opts:
- -DENABLE_BINDINGS_MONO=NO
- -DENABLE_BINDINGS_VALA=NO
- -DENABLE_GTKDOC=NO
- -DCMAKE_INSTALL_LIBDIR=lib
cleanup:
- /include
- /lib/pkgconfig
sources:
- type: archive
url: https://github.com/AyatanaIndicators/libayatana-appindicator/archive/refs/tags/0.5.93.tar.gz
sha256: cbefed7a918a227bf71286246e237fcd3a9c8499b3eaac4897811a869409edf0
# Workaround: Freedesktop 25.08 cmake may install to lib64 despite CMAKE_INSTALL_LIBDIR
# Copy any libraries from lib64 to lib so they can be found at runtime
- name: fix-lib64
buildsystem: simple
build-commands:
- |
if [ -d /app/lib64 ]; then
mkdir -p /app/lib
cp -a /app/lib64/* /app/lib/ 2>/dev/null || true
# Also copy pkgconfig if it exists
if [ -d /app/lib64/pkgconfig ]; then
mkdir -p /app/lib/pkgconfig
cp -a /app/lib64/pkgconfig/* /app/lib/pkgconfig/ 2>/dev/null || true
fi
fi
# List what we have for debugging
echo "=== Contents of /app/lib ==="
ls -la /app/lib/ || echo "lib is empty"
echo "=== Contents of /app/lib64 ==="
ls -la /app/lib64/ 2>/dev/null || echo "lib64 does not exist or is empty"
- name: qbz
buildsystem: simple
build-options:
append-path: /usr/lib/sdk/node24/bin:/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm20/bin
build-args:
- --share=network
env:
npm_config_nodedir: /usr/lib/sdk/node24
LIBCLANG_PATH: /usr/lib/sdk/llvm20/lib
build-commands:
- npm ci
- export PATH="$PWD/node_modules/.bin:$PATH" && npm run build
# Flathub policy: no competing auto-updaters. Disable the `updater`
# Cargo feature so tauri-plugin-updater / tauri-plugin-process are
# not linked into the Flatpak binary.
- export PATH="$PWD/node_modules/.bin:$PATH" && npm run tauri build -- --no-bundle -- --no-default-features
- install -Dm755 src-tauri/target/release/qbz /app/bin/qbz
- install -Dm644 packaging/flatpak/com.blitzfc.qbz.desktop /app/share/applications/com.blitzfc.qbz.desktop
- install -Dm644 packaging/flatpak/com.blitzfc.qbz.metainfo.xml /app/share/metainfo/com.blitzfc.qbz.metainfo.xml
- install -Dm644 LICENSE /app/share/licenses/com.blitzfc.qbz/LICENSE
- install -Dm644 src-tauri/icons/128x128.png /app/share/icons/hicolor/128x128/apps/com.blitzfc.qbz.png
- install -Dm644 src-tauri/icons/256x256.png /app/share/icons/hicolor/256x256/apps/com.blitzfc.qbz.png
# Install tray icon for StatusNotifierItem (symbolic icon for panel)
- install -Dm644 src-tauri/icons/tray.png /app/share/icons/hicolor/symbolic/apps/com.blitzfc.qbz-symbolic.png
- install -Dm644 src-tauri/icons/32x32.png /app/share/icons/hicolor/32x32/apps/com.blitzfc.qbz.png
sources:
- type: dir
path: ../..
skip:
- .git
- node_modules
- src-tauri/target
- .svelte-kit