#!/bin/sh
# rikkiti-greeter-session — greetd launches THIS as the greeter command. It sets the
# system keyboard layout (/etc/default/keyboard, written by the installer) as the XKB
# default so the LOGIN screen (and so the login password field) uses the chosen
# layout, not the us default, then execs the kiosk greeter under cage.
[ -r /etc/default/keyboard ] && . /etc/default/keyboard
export XKB_DEFAULT_LAYOUT="${XKBLAYOUT:-us}" XKB_DEFAULT_MODEL="${XKBMODEL:-pc105}"
export XKB_DEFAULT_VARIANT="${XKBVARIANT:-}" XKB_DEFAULT_OPTIONS="${XKBOPTIONS:-}"
# Same pointer as the session (rikkiti-session's XCURSOR_THEME / skald_settings'
# DEFAULT_CURSOR). cage is a wlroots compositor and honours this; without it the LOGIN
# screen shows the toolkit's default cursor and the pointer visibly changes the moment
# you log in — a poor first impression. breeze-cursor-theme is a rikkiti-desktop
# Depends, so the theme is always present by the time greetd runs this.
export XCURSOR_THEME="${XCURSOR_THEME:-Breeze_Light}" XCURSOR_SIZE="${XCURSOR_SIZE:-24}"
# Safe-graphics recovery boot (docs/47 Layer D): if the kernel cmdline requests safe
# graphics, force software GL so the LOGIN screen (cage) itself comes up even when
# hardware GL/Vulkan is broken — otherwise the user couldn't reach the recovery session.
if grep -q 'rikkiti.safe=1' /proc/cmdline 2>/dev/null; then
	export WLR_RENDERER_ALLOW_SOFTWARE=1 LIBGL_ALWAYS_SOFTWARE=1
fi
exec cage -s -- rikkiti-greeter
