36 lines
1.6 KiB
Bash
36 lines
1.6 KiB
Bash
#!/bin/sh
|
|
# SmartFox session: kiosk compositor (cage) with the launcher.
|
|
# Apps the launcher starts (Chromium etc.) appear full screen on top of it.
|
|
|
|
CONF="$HOME/.config/smartfox"
|
|
LOG="$HOME/smartfox.log"
|
|
# $HOME is on the data partition (/var). If it's missing, /var is the
|
|
# read-only root: still start the TV, just without saving anything.
|
|
if ! mkdir -p "$CONF" 2>/dev/null || ! touch "$LOG" 2>/dev/null; then
|
|
echo "sf-session: $HOME is read-only, settings will not be saved" >&2
|
|
CONF="$XDG_RUNTIME_DIR/smartfox"
|
|
LOG="$XDG_RUNTIME_DIR/smartfox.log"
|
|
mkdir -p "$CONF"
|
|
fi
|
|
[ -f "$CONF/settings.toml" ] || cp /usr/share/smartfox/settings.toml "$CONF/settings.toml"
|
|
|
|
export XDG_CONFIG_HOME="$(dirname "$CONF")"
|
|
export SMARTFOX_SOCKET="$XDG_RUNTIME_DIR/smartfox.sock"
|
|
export RUST_LOG="${RUST_LOG:-info}"
|
|
# No mouse on the TV: a transparent cursor theme (built in mkosi.postinst.chroot).
|
|
export XCURSOR_THEME=smartfox-blank XCURSOR_SIZE=24
|
|
|
|
# Output mode: the TV's preferred mode, except in VMs where the host window
|
|
# reports odd sizes. Override with SMARTFOX_MODE=WxH in /etc/default/smartfox.
|
|
[ -f /etc/default/smartfox ] && . /etc/default/smartfox
|
|
# Same, on the writable data partition (root is read-only), e.g. for debugging:
|
|
# echo 'RUST_LOG=sf_launcher=debug' > /var/lib/smartfox/session.env (fps every 5 s)
|
|
[ -f /var/lib/smartfox/session.env ] && . /var/lib/smartfox/session.env
|
|
export RUST_LOG
|
|
if [ -z "${SMARTFOX_MODE:-}" ] && systemd-detect-virt -q; then
|
|
SMARTFOX_MODE=1920x1080
|
|
fi
|
|
export SMARTFOX_MODE
|
|
|
|
exec cage -d -s -- /usr/bin/sf-launcher-start >>"$LOG" 2>&1
|