#!/bin/sh
set -eu

# Alma is an Electron app staged by apply_extra to /app/extra/alma. Run it
# through zypak-wrapper (from org.electronjs.Electron2.BaseApp): zypak redirects
# Chromium's SUID sandbox onto the Flatpak sandbox, so the app keeps an internal
# sandbox rather than running with --no-sandbox. --ozone-platform-hint=auto lets
# Chromium use Wayland when available and fall back to X11. Flatpak redirects
# $HOME, so the app's config and memory database stay sandboxed.
#
# Defensively clear ELECTRON_RUN_AS_NODE: if it leaks in from the launching
# environment (e.g. a terminal inside VS Code/Electron), the binary would start
# as plain Node instead of the GUI app.
unset ELECTRON_RUN_AS_NODE
exec zypak-wrapper /app/extra/alma/alma --ozone-platform-hint=auto "$@"
