# Sway kiosk session for the kitchen display (docs/project-plan.md Phase 17).
#
# Installed to /home/<KIOSK_USERNAME>/.config/sway/config by
# build-kitchen-display-iso.sh. A single-purpose device — one workspace, one
# Chromium kiosk window pointed at pantry-web's frontend (Scan / Inventory / Recipes
# is in-page tab navigation there, not separate Sway workspaces the way
# hosts/touch-panel switches between three different apps).

set $mod Mod4
set $ws_pantry 1:pantry

input type:keyboard {
    xkb_layout @KEYBOARD_LAYOUT@
}

# Real touchscreen hardware — native Wayland wl_touch, same assumption and same
# caveat as hosts/touch-panel/configs/sway/config (see that host's README
# verification list item 3).
input type:touch {
    map_to_output "*"
}

output * bg #101014 solid_color

default_border none
default_floating_border none
hide_edge_borders both
gaps inner 0
gaps outer 0

# kitchen-display-agent is NOT started here — systemd owns it, same reasoning as
# every other agent in this project (reachable over MQTT whether or not a graphical
# session is up, survives a sway restart).

for_window [app_id="chromium.*"] fullscreen enable
for_window [app_id="chromium.*"] inhibit_idle fullscreen

exec sh -c '[ -n "$PANTRY_WEB_URL" ] && { swaymsg workspace $ws_pantry; /usr/local/bin/pantry-kiosk; }'

# Blank after 20 minutes; any touch resumes it. No lock screen — same reasoning as
# every other kiosk image in this project: a shared kitchen display has nobody to
# unlock it.
exec swayidle -w \
    timeout 1200 'swaymsg "output * power off"' \
    resume      'swaymsg "output * power on"'

bindsym $mod+Shift+Ctrl+m exec foot --title maintenance-shell
for_window [title="maintenance-shell"] floating enable, resize set width 800 height 500, move position center

bindsym $mod+Return exec foot
bindsym $mod+q kill
bindsym $mod+Shift+c reload

# Deliberately no exit binding — same reasoning as the thin client/touch panel.

workspace $ws_pantry
