#!/usr/bin/env bash # OmniVoice Studio — AppImage launcher # # Issue #56: AppImage shows a white screen on Fedora 44 / Ubuntu 24.04. # Root cause: WebKitGTK 2.44.x / 2.46.x has a compositing-path regression on # Wayland that blanks the surface on first paint. Setting # WEBKIT_DISABLE_COMPOSITING_MODE=1 forces WebKit to use a software fallback # that works correctly. # # We detect the WebKit version via pkg-config and ONLY set the env var on the # known-broken ranges. Setting it unconditionally regresses healthy WebKit # versions (2.48+) where the compositing path works fine. # # This file is copied into the AppImage staging directory by # scripts/inject-apprun.sh (wired into Tauri's beforeBundleCommand). See # .planning/decisions/apprun-strategy.md for the decision rationale. set -euo pipefail HERE="$(dirname -- "$(readlink -f -- "$0")")" # Sourced by AppRun.test.sh — keep this function pure so unit tests can stub # `pkg-config`, source the file, call _detect_webkit_workaround, and inspect # the resulting environment without exec'ing the binary. _detect_webkit_workaround() { local wk_version="0.0" if command -v pkg-config >/dev/null 2>&1; then wk_version="$(pkg-config --modversion webkit2gtk-4.1 2>/dev/null \ || pkg-config --modversion webkit2gtk-4.0 2>/dev/null \ || echo "0.0")" fi case "$wk_version" in 2.44.*|2.46.*|0.0) export WEBKIT_DISABLE_COMPOSITING_MODE=1 ;; esac } _detect_webkit_workaround # Standard AppImage env that Tauri's auto-generated AppRun would have set. export LD_LIBRARY_PATH="${HERE}/usr/lib:${LD_LIBRARY_PATH:-}" export XDG_DATA_DIRS="${HERE}/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}" exec "${HERE}/usr/bin/omnivoice-studio" "$@"