45 lines
2.2 KiB
Plaintext
45 lines
2.2 KiB
Plaintext
;; The touch panel's on-screen dock — the primary local navigation surface (this
|
|
;; device is touched directly, unlike hosts/thin-client, which deliberately has no
|
|
;; bars because its primary control is HA/MQTT and wayvnc). Installed to
|
|
;; /home/<KIOSK_USERNAME>/.config/eww/eww.yuck by build-touch-panel-iso.sh.
|
|
;;
|
|
;; Session-scoped, not part of touchpanel-agent, same reasoning as the thin client's
|
|
;; now-playing widget: this is compositor UI, not device control, and dies with sway
|
|
;; rather than needing a restart-independent lifecycle. The :onclick strings below are
|
|
;; fixed constants in this file — nothing from MQTT, HA, or player metadata is ever
|
|
;; interpolated into them.
|
|
|
|
(defpoll active_workspace :interval "1s" :initial "2:home"
|
|
"swaymsg -t get_workspaces | jq -r '.[] | select(.focused) | .name' 2>/dev/null || echo 2:home")
|
|
|
|
(defwidget dock-btn [ws icon label]
|
|
(button :class {active_workspace == ws ? "dock-btn dock-btn-active" : "dock-btn"}
|
|
:onclick "swaymsg workspace ${ws}"
|
|
(box :orientation "vertical" :space-evenly false :spacing 2
|
|
(label :class "dock-icon" :text icon)
|
|
(label :class "dock-label" :text label))))
|
|
|
|
(defwidget dock-root []
|
|
(box :class "dock-root" :orientation "horizontal" :space-evenly false :spacing 8
|
|
:halign "center" :valign "center"
|
|
(dock-btn :ws "1:spotify" :icon "🎵" :label "Spotify")
|
|
(dock-btn :ws "2:home" :icon "🏠" :label "Home")
|
|
(dock-btn :ws "3:web" :icon "🌐" :label "Web")
|
|
(box :class "dock-sep")
|
|
(button :class "dock-btn" :onclick "toggle-keyboard"
|
|
(box :orientation "vertical" :space-evenly false :spacing 2
|
|
(label :class "dock-icon" :text "⌨")
|
|
(label :class "dock-label" :text "Keyboard")))))
|
|
|
|
;; :exclusive true reserves this strip so it is never overlapped by, and never steals
|
|
;; area from behind, the app on screen — unlike the thin client's overlay widgets,
|
|
;; which deliberately float over fullscreen video. A dock a finger can miss because
|
|
;; something else drew over it is worse than a smaller app area.
|
|
(defwindow touch-dock
|
|
:monitor 0
|
|
:geometry (geometry :width "100%" :height "84px" :anchor "bottom center")
|
|
:stacking "overlay"
|
|
:exclusive true
|
|
:focusable false
|
|
(dock-root))
|