#!/bin/sh
set -eu

# electerm is an Electron app staged by apply_extra to /app/extra/electerm.
# 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 ~/.config/electerm stays 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/electerm/electerm --ozone-platform-hint=auto "$@"
