#!/bin/sh
set -eu

# zux is a single Tauri (WebKitGTK) binary staged by apply_extra to
# /app/extra/zux. It links only against libraries in org.gnome.Platform
# (webkit2gtk-4.1, gtk-3, libsoup-3, dbus-1); it has no tray-icon dependency,
# so no ayatana stack is needed. mDNS/DNS-SD service discovery runs over
# multicast UDP on the host network namespace, which the sandbox shares via
# --share=network. The unbundled binary ships without Tauri's auto-updater, so
# it never downloads anything at runtime. Files are written only through the
# file dialog (xdg-desktop-portal), and the app's own state lands under XDG
# dirs, which Flatpak redirects into ~/.var/app/io.github.hrzlgnm.zux.

# WebKitGTK's DMABUF renderer paints a blank window under many drivers inside
# the Flatpak sandbox — disabling it is the reliable default for Tauri apps
# here. The binary also self-applies session-aware NVIDIA workarounds via the
# webkit2gtk-nvidia-quirk crate.
export WEBKIT_DISABLE_DMABUF_RENDERER=1

exec /app/extra/zux "$@"
