diff --git a/image-recipe/_archived/build-auto-installer-iso.sh b/image-recipe/_archived/build-auto-installer-iso.sh index 99906345..c4fb837f 100755 --- a/image-recipe/_archived/build-auto-installer-iso.sh +++ b/image-recipe/_archived/build-auto-installer-iso.sh @@ -2490,6 +2490,17 @@ HandleLidSwitchExternalPower=ignore HandleLidSwitchDocked=ignore LIDCONF +# Kiosk appliance: a short press or accidental brush of the power button used +# to shut the node down instantly (confirmed on a Framework node — "Power key +# pressed short -> Powering off"). Ignore the short press; keep a deliberate +# long press (hold ~2s) as the intentional power-off, so the node isn't taken +# down by accident but can still be shut down on purpose without a keyboard. +cat > /mnt/target/etc/systemd/logind.conf.d/power-key.conf <<'PWRCONF' +[Login] +HandlePowerKey=ignore +HandlePowerKeyLongPress=poweroff +PWRCONF + # Copy Archipelago binaries and files if [ -d "$BOOT_MEDIA/archipelago/bin" ]; then cp -r "$BOOT_MEDIA/archipelago/bin/"* /mnt/target/usr/local/bin/ 2>/dev/null || true @@ -2649,6 +2660,11 @@ if [ -t 0 ] && [ -z "$ARCHIPELAGO_WELCOMED" ]; then W='\033[1;37m' N='\033[0m' + # The logo uses UTF-8 block-drawing glyphs. Switching back from the kiosk + # (Xorg on vt1) can leave the console VT out of UTF-8 mode, which renders + # them as garbage bytes ("sometimes corrupt"). ESC % G forces the VT into + # UTF-8 mode so the logo always draws correctly. + printf '\033%%G' 2>/dev/null || true clear echo -e " ${O}▄▀█ █▀▄ █▀▀ █ █ █ █▀█ █▀▀ █ ▄▀█ █▀▀ █▀█${N}" echo -e " ${O}█▀█ █▀▄ █ █▀█ █ █▀▀ ██▀ █ █▀█ █ █ █ █${N}" @@ -2664,10 +2680,14 @@ if [ -t 0 ] && [ -z "$ARCHIPELAGO_WELCOMED" ]; then if [ -b /dev/mapper/archipelago-data ] || [ -b /dev/mapper/archipelago_crypt ]; then echo -e " ${OD}storage LUKS2 encrypted${N}" fi + # The kiosk's Xorg runs on vt1 (see archipelago-kiosk-launcher: "Xorg :0 + # vt1"), so Ctrl+Alt+F1 IS the kiosk and a terminal is on another VT (F2, + # where systemd auto-spawns a getty). The old hints had these backwards — + # they sent you to an empty black VT7 and there was no way back to the kiosk. if systemctl is-active archipelago-kiosk.service >/dev/null 2>&1; then - echo -e " ${OD}display Kiosk active (Ctrl+Alt+F1 for terminal)${N}" + echo -e " ${OD}display Kiosk active (Ctrl+Alt+F2 for terminal)${N}" else - echo -e " ${OD}display Console (Ctrl+Alt+F7 for kiosk)${N}" + echo -e " ${OD}display Console (Ctrl+Alt+F1 for kiosk)${N}" fi echo "" fi diff --git a/image-recipe/configs/archipelago-kiosk-launcher.sh b/image-recipe/configs/archipelago-kiosk-launcher.sh index 6cead151..7815578e 100644 --- a/image-recipe/configs/archipelago-kiosk-launcher.sh +++ b/image-recipe/configs/archipelago-kiosk-launcher.sh @@ -82,6 +82,24 @@ configure_display() { configure_display +# --- Kiosk UI scaling for large / high-res displays ----------------------- +# REVERT: set env ARCHIPELAGO_KIOSK_SCALE=1 (per-node, no rebuild), or restore +# the hardcoded --force-device-scale-factor=1 below to disable entirely. +# +# A big TV reports its full native resolution as the CSS viewport, so a 4K +# panel becomes a 3840px-wide viewport and the UI renders tiny — and a +# keyboard-less kiosk can't zoom. Derive Chromium's device-scale-factor from +# the detected panel width so the *effective* CSS viewport lands near a +# comfortable across-the-room target, scaling the whole UI up on big screens: +# 1920x1080 -> 1.50 | 2560x1440 -> 2.00 | 3840x2160 -> 3.00 (clamped 1.0-3.0) +KIOSK_TARGET_CSS_WIDTH=${ARCHIPELAGO_KIOSK_TARGET_CSS_WIDTH:-1280} +if [ -n "${ARCHIPELAGO_KIOSK_SCALE:-}" ]; then + KIOSK_SCALE=$ARCHIPELAGO_KIOSK_SCALE +else + KIOSK_SCALE=$(awk -v w="$KIOSK_MODE_W" -v t="$KIOSK_TARGET_CSS_WIDTH" \ + 'BEGIN{if(t<=0)t=1280; s=w/t; s=int(s*4+0.5)/4; if(s<1)s=1; if(s>3)s=3; printf "%.2f", s}') +fi + xhost +SI:localuser:archipelago 2>/dev/null || true xsetroot -solid black 2>/dev/null || true xset s off 2>/dev/null || true @@ -142,7 +160,7 @@ while true; do --window-size=${KIOSK_MODE_W},${KIOSK_MODE_H} \ --window-position=0,0 \ --start-fullscreen \ - --force-device-scale-factor=1 \ + --force-device-scale-factor=${KIOSK_SCALE} \ --disable-background-networking \ --disable-background-timer-throttling \ --disable-backgrounding-occluded-windows \