#!/bin/sh
# init=/usr/bin/desk-explorer : compositor + panel + ONE file manager window on C:\ (/c); the test (scripts/test-explorer.sh)
# then clicks through it with the QEMU monitor mouse.
. /usr/bin/desk-env
/usr/bin/pomelo-compositor 2>/tmp/compositor.log &
cpid=$!
i=0
while [ $i -lt 100 ] && [ ! -S "$XDG_RUNTIME_DIR/wayland-0" ]; do sleep 0.2; i=$((i+1)); done
export WAYLAND_DISPLAY=wayland-0
export XDG_DATA_DIRS=/usr/share
/usr/bin/pomelo-panel 2>/tmp/panel.log &
ppid=$!
sleep 5
/usr/bin/pomelo-files ${DESK_EXPLORER_START:-/c} 2>/tmp/files1.log &
f1=$!
N=${DESK_EXPLORER_SECONDS:-200}; t=0
while [ $t -lt $N ] && kill -0 $cpid 2>/dev/null; do sleep 1; t=$((t+1)); done
echo "--- files log"; head -10 /tmp/files1.log
kill $f1 $ppid $cpid 2>/dev/null
wait $f1 $ppid $cpid 2>/dev/null
exit 0
