#!/bin/sh
export XDG_CURRENT_DESKTOP=MithraUI

# touchscreen appears late some boots and can hotplug in floating - retry
(
    for _ in $(seq 1 30); do
        if xinput list --name-only 2>/dev/null | grep -qx touchscreen; then
            xinput reattach "touchscreen" "Virtual core pointer" 2>/dev/null
            break
        fi
        sleep 1
    done
) &

openbox --config-file /etc/mithra/openbox-rc.xml &

if [ ! -e "$HOME/.config/mithra/oobe-done" ]; then
    mithra-oobe
fi
[ -r "$HOME/.config/mithra/env" ] && . "$HOME/.config/mithra/env"

exec mithra-shell
