Add live calendar state to Quickshell
This commit is contained in:
Executable
+39
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
fail() {
|
||||
printf 'calendar agenda contract: %s\n' "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
qs ipc call calendar-agenda reset >/dev/null 2>&1 || true
|
||||
qs ipc call calendar-agenda close >/dev/null 2>&1 || true
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
qs ipc show | rg -q '^target calendar-agenda$' \
|
||||
|| fail 'calendar IPC target is missing'
|
||||
|
||||
qs ipc call calendar-agenda fixture daybook >/dev/null
|
||||
status="$(qs ipc call calendar-agenda status)"
|
||||
jq -e '
|
||||
.fixture == true and
|
||||
.sourceCount == 3 and
|
||||
.eventCount == 5 and
|
||||
.selectedDate == "2026-08-17"
|
||||
' <<<"$status" >/dev/null || fail 'daybook fixture state is malformed'
|
||||
|
||||
qs ipc call calendar-agenda select 2026-08-18 >/dev/null
|
||||
jq -e '.selectedDate == "2026-08-18" and .selectedEventCount == 1' \
|
||||
<<<"$(qs ipc call calendar-agenda status)" >/dev/null \
|
||||
|| fail 'date selection did not update events'
|
||||
|
||||
qs ipc call calendar-agenda reset >/dev/null
|
||||
jq -e '.fixture == false' <<<"$(qs ipc call calendar-agenda status)" >/dev/null \
|
||||
|| fail 'fixture reset did not restore live mode'
|
||||
|
||||
trap - EXIT
|
||||
cleanup
|
||||
printf 'calendar agenda contract: PASS\n'
|
||||
Reference in New Issue
Block a user