#!/bin/sh
# NeoFlux Media Center startup — run once per login (not on Reconfigure or
# Restart). Fills ONE slit along the bottom of the screen with the flux dock
# apps: eight 240 px tiles span a 1920 px screen exactly, and a bottom slit
# costs a widescreen (2.39:1) film nothing in fill mode — the picture sits in
# its own black bars anyway. Slit numbers: 0 = top, 1 = right, 2 = bottom,
# 3 = left. The dock apps take any --size from 64 to 1024; 240 reads from the
# couch on a 42-inch 1080p set at ten feet.
#
# Each line is guarded so a program that is not installed is simply skipped.
# Order along the slit comes from the slitlist file next to this one.

SIZE=240
SLIT=2

start() { command -v "$1" >/dev/null 2>&1 && "$@" & }

# Shared weather/astronomy data for fluxWeather (one daemon, polls hourly).
start fluxData --background

start fluxCalClock --dock $SLIT --size $SIZE --short-month   # "OCT", drawn large
start fluxWeather  --dock $SLIT --size $SIZE

# Two launchers = eight apps. The second reads its own config file; create it
# with:  fluxLauncher --config ~/.config/fluxLauncher/second --write-config
start fluxLauncher --dock $SLIT --size $SIZE
start fluxLauncher --dock $SLIT --size $SIZE --config "$HOME/.config/fluxLauncher/second"

# System tray (network, Bluetooth, media players): stalonetray in dockapp mode,
# a 4x4 grid of 60 px icons = one 240 px tile.
start stalonetray --dockapp-mode simple --geometry 4x4 --icon-size 60 --background "#000000"

# Two picture frames, each with its own folder (edit the paths).
start fluxPics --dock $SLIT --size $SIZE --directory "$HOME/Pictures"
start fluxPics --dock $SLIT --size $SIZE --directory "$HOME/Pictures/Family" --config "$HOME/.config/fluxPics/second"

start fluxVolume --dock $SLIT --size $SIZE

# Game pad → keys (idles until a pad is plugged in; see nfmc-pad --help).
start nfmc-pad

# Optional extras — uncomment what you want (each is another tile; past eight
# at 240 px the slit wraps or you move them to --dock 1, the right edge):
# start fluxWebCam      --dock $SLIT --size $SIZE --camera porch
# start fluxPlayer      --dock $SLIT --size $SIZE
# start fluxPowerControl --dock $SLIT --size $SIZE   # lock / suspend buttons
# start fluxBattery     --dock $SLIT --size $SIZE   # UPS charge, if you have one

# Wallpaper / compositor, if wanted:
# feh --bg-fill "$HOME/Pictures/wallpaper.png" &
# picom &
