#!/usr/bin/env bash
# Start the Sunshine streaming host in the console (kid) account's session,
# so the parent can connect with Moonlight whenever the console is in use.
# Sunshine replaces RDP as the remote-admin path: GNOME RDP crashes mutter
# on the BC-250 (cursor-metadata screencast segfault, mutter 50.3).
[ -r /etc/bc250-console.conf ] && . /etc/bc250-console.conf
[ "$(id -un)" = "${CONSOLE_KID_USER:-kid}" ] || exit 0
flatpak info dev.lizardbyte.app.Sunshine >/dev/null 2>&1 || exit 0
exec systemctl --user enable --now app-dev.lizardbyte.app.Sunshine.service
