Files
menologion/eww/menologion.yuck
T

85 lines
3.1 KiB
Plaintext
Raw Normal View History

2026-09-18 10:52:56 -04:00
;; menologion — the liturgical day for eww
2026-09-18 09:17:14 -04:00
;;
;; Include this from your own eww.yuck:
;;
2026-09-18 10:52:56 -04:00
;; (include "menologion/menologion.yuck")
2026-09-18 09:17:14 -04:00
;;
2026-09-18 10:52:56 -04:00
;; and put (menologion) in a window, or (menologion-bar) in a bar. Set a
2026-09-18 10:29:37 -04:00
;; jurisdiction by adding `--jurisdiction <name>` to both defpoll commands
;; below; leaving them as they are follows whatever `typikon --set-default`
;; wrote.
2026-09-18 09:17:14 -04:00
(defpoll typikon-day
:interval "30m"
:initial "{}"
`typikon --json`)
(defpoll typikon-week
:interval "30m"
:initial "{\"days\":[]}"
2026-09-18 10:29:37 -04:00
;; From tomorrow, not today: the head block above already shows today in
;; full, and simplexpr has no way to drop the first element of a list.
`typikon --json --days 6 --date $(date -d tomorrow +%F)`)
2026-09-18 09:17:14 -04:00
;; ── the one-line version, for a bar
2026-09-18 10:52:56 -04:00
(defwidget menologion-bar []
(box :class "menologion-bar"
2026-09-18 09:17:14 -04:00
:space-evenly false
:spacing 6
(label :class "glyph" :text {typikon-day.emoji ?: ""})
(label :class "title"
:limit-width 42
:text {typikon-day.title ?: "typikon?"})))
;; ── the full panel
2026-09-18 10:52:56 -04:00
(defwidget menologion []
(box :class "menologion"
2026-09-18 09:17:14 -04:00
:orientation "v"
:space-evenly false
:spacing 8
(box :class "head" :space-evenly false :spacing 11
(label :class "glyph-big" :text {typikon-day.emoji ?: ""})
(box :orientation "v" :space-evenly false :halign "start" :hexpand true
2026-09-18 10:29:37 -04:00
(label :class {(typikon-day.feast ?: "") != "" ? "title feast" : "title"}
2026-09-18 09:17:14 -04:00
:halign "start"
:wrap true
:lines 2
:text {typikon-day.title ?: "typikon is not on PATH"})
(label :class {typikon-day.obligation == "obligatory"
? "sub obligatory" : "sub"}
:halign "start"
:text "${typikon-day.weekday ?: ""}${
2026-09-18 10:29:37 -04:00
(typikon-day.season ?: "") != "" ? " · " : ""}${
2026-09-18 09:17:14 -04:00
typikon-day.season ?: ""}${
typikon-day.obligation == "obligatory"
? " · obligatory" : ""}")
(label :class "cycle"
:halign "start"
:visible {(typikon-day.cycle ?: "") != ""}
:text {typikon-day.cycle ?: ""})))
(label :class "fast"
:halign "start"
:text "${typikon-day.fastLabel ?: ""}${
(typikon-day.reason ?: "") != ""
? " — " : ""}${typikon-day.reason ?: ""}")
(box :class "rule")
;; the rest of the week
(box :orientation "v" :space-evenly false :spacing 2
(for d in {typikon-week.days ?: []}
(box :space-evenly false :spacing 9
(label :class "glyph" :text {d.emoji})
(label :class "weekday" :width 34 :xalign 0 :text {d.weekday})
2026-09-18 10:29:37 -04:00
(label :class {(d.feast ?: "") != "" ? "day feast" : "day"}
2026-09-18 09:17:14 -04:00
:hexpand true :xalign 0 :limit-width 40 :text {d.title}))))
(box :class "rule")
(box :space-evenly false
(label :class "pascha" :hexpand true :xalign 0
:text "Pascha ${typikon-day.pascha ?: ""}")
(label :class "pascha" :text {typikon-day.churchDate ?: ""}))))