#!/bin/sh
# On-screen keyboard (docs/project-plan.md Phase 16), toggled from the touch dock's
# Keyboard button. Same apt-first/documented-placeholder pattern as eww and the
# headless Spotify Connect receiver: wvkbd is not in Debian bookworm main (it's a
# small C wlroots layer-shell client, normally built from source).
set -eu

if apt-get install -y --no-install-recommends wvkbd 2>/dev/null; then
  echo "0700-onscreen-keyboard: installed wvkbd from apt."
elif command -v wvkbd-mobintl >/dev/null 2>&1; then
  echo "0700-onscreen-keyboard: wvkbd-mobintl already present."
else
  echo "0700-onscreen-keyboard: wvkbd is not available from the configured apt sources."
  echo "  Typing into Spotify search, the HA dashboard, or the web browser will have no"
  echo "  on-screen keyboard until it's installed:"
  echo "    a) build from source: https://github.com/jjsullivan5196/wvkbd"
  echo "       (needs libwayland-dev, wayland-protocols, cairo, pango — add a"
  echo "       build-dependencies block to this hook if you go this route), or"
  echo "    b) fetch a distro package once one exists for your release."
  echo "  configs/keyboard/toggle-keyboard already handles a missing binary as a no-op"
  echo "  (the dock button just does nothing), so the rest of the session is unaffected."
fi
