#!/bin/bash
# RaveOS App Installer launcher

LIB_DIR="/usr/lib/raveos-app-installer"

# Hyprland: WAYLAND_DISPLAY és HYPRLAND_INSTANCE_SIGNATURE auto-detektálás
USER_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
if [[ -z "${WAYLAND_DISPLAY:-}" ]]; then
    for _wl in "${USER_RUNTIME_DIR}"/wayland-*; do
        [[ -S "$_wl" ]] && WAYLAND_DISPLAY="$(basename "$_wl")" && break
    done
    export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-wayland-1}"
fi
if [[ -z "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]]; then
    export HYPRLAND_INSTANCE_SIGNATURE
    HYPRLAND_INSTANCE_SIGNATURE="$(ls "${USER_RUNTIME_DIR}/hypr/" 2>/dev/null | head -1 || true)"
fi

exec python3 "${LIB_DIR}/raveos-app-installer.py" "$@"
