#!/bin/sh
# openbox session: launch tint2 taskbar + chromium, then openbox as WM.
# This file is used as an xinitrc by bee-desktop.

# Disable screensaver and DPMS
xset s off
xset -dpms
xset s noblank

tint2 &

# Wait up to 120s for bee-web to bind. The web server starts immediately now
# (audit is deferred), so this should succeed in a few seconds on most hardware.
i=0
while [ $i -lt 120 ]; do
    if curl -sf http://localhost/healthz >/dev/null 2>&1; then break; fi
    sleep 1
    i=$((i+1))
done

chromium \
    --disable-infobars \
    --disable-translate \
    --no-first-run \
    --disable-session-crashed-bubble \
    --disable-features=TranslateUI \
    --start-maximized \
    http://localhost/ &

exec openbox
