#!/bin/sh
set -eu

# Vibe is a Tauri/WebKitGTK app staged by apply_extra at /app/extra/bin,
# alongside the whisper.cpp engine ("sona") it starts as a sidecar and finds by
# looking next to its own executable. The libraries both link are supplied by
# org.gnome.Platform, except libxdo, which the manifest builds into /app/lib.
# Transcoding uses the runtime's ffmpeg, which Vibe resolves from PATH.

# Use WebKitGTK's non-DMABUF rendering path for reliable rendering in Flatpak.
export WEBKIT_DISABLE_DMABUF_RENDERER=1

# apply_extra resolves the launcher's upstream name from the .deb's own .desktop
# file and records it next to the staged tree, so it is not hardcoded here.
launcher="$(cat /app/extra/launcher 2>/dev/null || true)"
[ -n "$launcher" ] || launcher=vibe

exec "/app/extra/bin/$launcher" "$@"
