#!/usr/bin/env bash
# RakuOS Welcome launcher
# Auto-detects DE or can be forced with --ui=gtk|qt|cosmic
# Usage: rakuos-welcome [--ui=gtk|qt|cosmic] [--force]

UI=""
PASSTHROUGH=()

for arg in "$@"; do
    case "$arg" in
        --ui=gtk)    UI="gtk" ;;
        --ui=qt)     UI="qt" ;;
        --ui=cosmic) UI="cosmic" ;;
        *)           PASSTHROUGH+=("$arg") ;;
    esac
done

if [[ -z "$UI" ]]; then
    case "$XDG_CURRENT_DESKTOP" in
        *GNOME*)  UI="gtk" ;;
        *KDE*)    UI="qt" ;;
        *)        UI="cosmic" ;;
    esac
fi

exec /usr/libexec/rakuos/rakuos-welcome-${UI} "${PASSTHROUGH[@]}"
