diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-13 16:39:50 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-13 16:39:50 +0100 |
| commit | 6b03740a8c9fb98b788549412f0ebf3cbae1d2de (patch) | |
| tree | 85f9532f1efdc63ecebb9c42a3e7a3c0b764e5d3 /deckit/server.py | |
| parent | 4bc6d69fc0fbfc3de5fb84874985a26deb79fdb5 (diff) | |
| download | deck-it-6b03740a8c9fb98b788549412f0ebf3cbae1d2de.tar.gz deck-it-6b03740a8c9fb98b788549412f0ebf3cbae1d2de.zip | |
feat(tablet): clock fonts and sizes from keystone's Fonts page
The dim cover's time and date fonts move out of [tablet] clock_font and
clock_font_date into keystone's fonts.json: "family" deckit-clock and
deckit-date, each served at /fonts/<key>, and the "override" sizes
deckit:clock and deckit:date (else deck.css's 8rem and 1.6rem). The date
can now have a font of its own. theme.css carries the rules, so a save
on the Fonts page reaches an open tablet page within 5s, with no restart
and no flags in the tablet state.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'deckit/server.py')
| -rw-r--r-- | deckit/server.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/deckit/server.py b/deckit/server.py index 2ced8dd..bd46446 100644 --- a/deckit/server.py +++ b/deckit/server.py @@ -142,10 +142,11 @@ def nerd_font(): return _font["p"] -def clock_font(): - """[tablet] clock_font's file, for the dim cover's clock; None when unset - or not installed (fc-match falls back to any font, so the family must match).""" - family = CFG.get("tablet", {}).get("clock_font", "") +def clock_font(key): + """The file of a clock font keystone's fonts.json names (theme.CLOCK_FONTS); + None when unset or not installed (fc-match falls back to any font, so the + family must match).""" + family = theme.families().get(key, "") if not family: return None out = _run(["fc-match", "-f", "%{family}\n%{file}", family]) @@ -219,8 +220,8 @@ class Handler(BaseHTTPRequestHandler): if path == "/fonts/nerd.ttf": f = nerd_font() return self._send(200, f.read_bytes(), "font/ttf", cache=True) if f else self._send(404) - if path == "/fonts/clock": - f = clock_font() + if path.startswith("/fonts/") and path[len("/fonts/"):] in theme.CLOCK_FONTS: + f = clock_font(path[len("/fonts/"):]) return self._send(200, f.read_bytes(), mimetypes.guess_type(f)[0] or "font/ttf") if f else self._send(404) if path.startswith("/api/"): if not self._authed(): |
