1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# colitur-x
A raw Xlib front-end for [colitur](../colitur): reads `colitur emit --format
csv` on stdin, draws the year as a month grid coloured by each day's
liturgical colour, and shows the selected day's readings underneath.
make && make install # into ~/.local/bin
colitur emit --format csv --from 2027 --to 2027 | colitur-x
Keys: arrows or `hjkl` move, `n`/`p` change month, `q` quits.
It reads CSV on **stdin** and nothing else, so the shell decides what it
shows. One month:
colitur emit --format csv --from 2027 --to 2027 | grep "^2027-04" | colitur-x
The header line is detected rather than assumed, so filtering it away is
fine. An earlier version skipped the first line unconditionally, which meant
that pipeline silently dropped 1 April -- the program fought the obvious
filter instead of composing with it.
Another language, or a local calendar:
colitur emit --format csv --from 2027 --to 2027 --lang en | colitur-x
colitur emit --format csv --from 2027 --to 2027 \
--overlay ~/parish.sexp | colitur-x
With no input it says so and exits 2.
## Why it exists
colitur is a Unix tool: it computes and prints. This is a separate program
that composes with it, so colitur's own dependencies stay frozen
(`dune alcotest qcheck qcheck-alcotest sexplib ppx_sexp_conv`) and its
kernel stays pure.
## Build
make
`-std=c99 -Os -Wall -Wextra`, linking libX11 and libXft. ~17 KB.
Configuration is compile-time, suckless style: edit `config.h` and rebuild.
There is deliberately no runtime config file — colitur itself owns the
calendar's configuration (language, sigla, overlays); this program owns only
how it is painted.
## Limits, stated rather than discovered
- X11 only. Runs under XWayland but is not a Wayland client.
- Read-only. It renders what colitur emits; it edits nothing.
- Xft is used for antialiasing and UTF-8. Dropping it for core X11 fonts
would reduce the dependency list to libX11 and libc alone, at the cost of
correct rendering for `æ`/`œ` and Polish diacritics. Not worth it.
- A tiling window manager will ignore the size hints and give the grid its
own tile; the layout handles that, the empty space is the WM's choice.
## colitur-mu — the microui variant
`colitur-mu` is the same idea with an *editable* surface: year, language,
book-name form and numbering tradition are buttons, and changing any of them
re-runs colitur and reloads. It reimplements no calendar logic — every value
on screen came out of `colitur emit --format csv`, and the exact command is
shown in the status line.
make colitur-mu && ./colitur-mu
microui (MIT, rxi) is **vendored** in `vendor/`, 1504 lines. That is the point:
a copied-in dependency cannot rot. `mu_x11.c` is the Xlib/Xft backend, ~150
lines — microui emits a command list and asks two font-metric questions; this
answers them.
### One bug worth recording
microui resets its scissor by emitting an "unclipped" rectangle of
`0x1000000` × `0x1000000`. `XRectangle`'s width and height are **unsigned
short**, so that truncates to **0** — turning "clip nothing" into "clip
everything". The symptom is that a scrolling panel draws its first screenful
and everything after it silently disappears, which looks like a layout or
buffer-overflow bug and is neither. `set_clip()` clamps to the buffer bounds
before converting.
### Verifying a frame without a screenshot
MUX_DUMP=/tmp/frame.ppm ./colitur-mu # writes one frame, then exits
convert /tmp/frame.ppm /tmp/frame.png
This reads back the off-screen PIXMAP, not the window. A window's contents
are not retained while it is obscured or sitting on an unfocused tag, so
`import`/`xwd` against one can return solid black while the program is
drawing perfectly -- which cost real time to work out once. A pixmap is
always there.
### Which to use
`colitur-x` renders; `colitur-mu` renders and lets you change the invocation.
Neither is the right answer for a non-technical user on a machine that is not
yours — both are X11-only and must be compiled. For that, a static site or a
small local web UI wins.
|