Files
os/image/mkosi.extra/usr/bin/sf-launcher-start
Tamas Csikel 9c710bedb9 Fennec OS 0.3.2: one app at a time, Raspberry Pi shell packages
- sf-core: only one app runs. Home, another app or a cast closes the app
  on screen (after the switch animation) instead of freezing it in the
  background. A frozen app that held a sound stream stalled PipeWire, so
  the next app could not play at all ("Failed to connect stream: No such
  entity" in Netflex after YouTube was sent home mid-video). The
  background limit and the low-memory watcher go with the freezing.
- Raspberry Pi: image/pi (installer on Raspberry Pi OS), aarch64 shell
  packages (sf-shell-<v>-aarch64, arch in pkg.toml, sf-update installs only
  its own architecture), CI builds the aarch64 shell too.
- sf-compositor: volume OSD, screencopy for remote view, blank cursor.
- SDK v0.1.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 19:38:09 +01:00

51 lines
2.3 KiB
Bash

#!/bin/sh
# Runs inside the compositor (sf-compositor, or cage as a fallback): apply
# the output mode, start sf-core, then the launcher.
if [ -n "${SMARTFOX_MODE:-}" ]; then
OUT=$(wlr-randr | awk 'NR==1 {print $1}')
wlr-randr --output "$OUT" --custom-mode "$SMARTFOX_MODE" ||
echo "sf-launcher-start: could not set $SMARTFOX_MODE on $OUT"
fi
# The launcher from the installed sf-shell package, else the factory copy.
# A new shell is on trial until it has run for a while (it then drops a
# "confirm" request). If it doesn't get there in 3 starts, ask sf-update to
# roll it back and start the factory launcher meanwhile (docs/updates.md).
PKG=/var/lib/sf-pkg/sf-shell
REQ=/var/lib/smartfox/update-requests
TRIES=/var/lib/smartfox/shell-tries
LAUNCHER=/usr/bin/sf-launcher
if [ -x "$PKG/current/bin/sf-launcher" ]; then
LAUNCHER="$PKG/current/bin/sf-launcher"
if [ -f "$PKG/trial" ]; then
n=$(($(cat "$TRIES" 2>/dev/null || echo 0) + 1))
echo "$n" >"$TRIES"
if [ "$n" -gt 3 ]; then
echo "sf-launcher-start: shell $(cat "$PKG/trial") failed $((n - 1)) times, rolling back"
rm -f "$TRIES"
touch "$REQ/rollback"
LAUNCHER=/usr/bin/sf-launcher
else
export SMARTFOX_SHELL_TRIAL=1
fi
else
rm -f "$TRIES"
fi
fi
# Remote viewing for development (README, "Távoli képernyő (VNC)"): wayvnc
# on localhost only, reached through an ssh tunnel. No --gpu by default:
# wayvnc's H.264 encoder crashes on the Raspberry Pi 4 (wayvnc 0.10);
# SMARTFOX_VNC_ARGS=--gpu in session.env turns it on where it works.
if [ "${SMARTFOX_REMOTE_VIEW:-0}" = 1 ] && command -v wayvnc >/dev/null; then
pkill -u "$(id -u)" -x wayvnc 2>/dev/null
# shellcheck disable=SC2086
wayvnc ${SMARTFOX_VNC_ARGS:-} --max-fps=30 --name="Fennec OS" 127.0.0.1 5900 &
fi
# sf-core starts and freezes apps, runs DIAL (YouTube cast) and the AirPlay /
# Miracast receivers. It quits by itself when this Wayland session ends.
pkill -u "$(id -u)" -x sf-core 2>/dev/null
# Store apps (sandboxed, docs/store.md): /var/lib/sf-pkg/store/apps.
/usr/bin/sf-shell-exec sf-core --apps /usr/share/smartfox/apps --apps /var/lib/sf-pkg/apps --store-apps /var/lib/sf-pkg/store/apps &
exec "$LAUNCHER" --fullscreen --apps /usr/share/smartfox/apps --apps /var/lib/sf-pkg/apps --store-apps /var/lib/sf-pkg/store/apps