aboutsummaryrefslogtreecommitdiffstats
path: root/AGENTS.md
diff options
context:
space:
mode:
Diffstat (limited to 'AGENTS.md')
-rw-r--r--AGENTS.md91
1 files changed, 91 insertions, 0 deletions
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000..b693c00
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,91 @@
+# AGENTS.md
+
+Guidance for AI coding agents working in this repository.
+
+## What this is
+
+`phone-customization`: home screen customizations for an Android phone
+(Pixel, Niagara launcher). Today it holds one thing, `clock/`: a KWGT widget
+preset that replaces Niagara's clock with a tall, narrow, glassy iOS-style
+lock-screen clock, plus the two build scripts for its fonts. The preset is
+hand-written JSON, there is no editor round-trip. Build scripts need
+fontTools only (`pip install fonttools`, build time); nothing runs on the
+phone besides KWGT.
+
+## clock/ layout
+
+- `src/preset.json`: the KWGT preset. `src/fonts/`: fonts bundled into the
+ `.kwgt` plus their license files. `src/preset_thumb_*.jpg`: thumbnails
+ KWGT requires.
+- `tallclock.kwgt`: zip of `src/` (preset.json, thumbs, `fonts/*.ttf`),
+ committed so it can be pushed to the phone without building.
+- `mkfont.py`: builds `TallClock-vN.ttf` from Oswald (OFL), `wght=400`,
+ squeezed to x0.51. It also normalizes vertical metrics (0.24 em above the
+ digits for the date, ~0 below), centres the colon on the digits and
+ redraws its dots as circles. The preset layout depends on those metrics.
+- `mkicons.sh`: builds `WeatherIcons.ttf`, a 14-glyph subset of Material
+ Symbols Rounded (Apache-2.0). The preset maps `wi(icon)` to these
+ codepoints; keep the two lists in sync.
+
+## KWGT preset facts (learned by trial on KWGT 3.82)
+
+- A property driven by a formula needs both `"internal_toggles": {"<key>": 10}`
+ and `"internal_formulas": {"<key>": "$...$"}`. 100 means a global instead.
+- Formula-driven `text_size` works. Formula-driven `position_offset_y` was
+ ignored, so the date is placed with `position_anchor: TOP` inside the
+ clock's empty ascent instead of by offset.
+- Sizes come from `mu(min, si(rheight)*a, si(rwidth)*b)` so the clock fits
+ any widget size. Current ratios (TallClock-v3 at size TS): line box
+ 1.08 TS, digits 0.83 TS, "21:36" 1.09 TS wide; date 0.15 TS, event line
+ 0.1 TS, hence `TS = mu(min, si(rheight)*0.8, si(rwidth)*0.88)`. Re-measure
+ (PIL `getmetrics`/`getbbox`) after changing a font.
+- Wallpaper colors: `si(sysca1, N)` (Material You). Observed: low N is dark,
+ high N is light, the opposite of what the docs suggest. 85 to 95 gives the
+ light glass tint.
+- Glass look: fill with `fx_gradient: VERTICAL` from ~90% to ~8% alpha, plus a
+ second, outline-only copy on top (`paint_style: STROKE`) fading to clear.
+- Shadow keys: `fx_shadow: OUTER`, `fx_shadow_color/direction/distance/blur`.
+ Direction 270 drops the shadow downward.
+- Tap actions: `internal_events` with `LAUNCH_APP` and an `intent:` URI. The
+ clock app on this phone is `com.android.deskclock/.DeskClock` (not the
+ Google package), the calendar is Etar (`ws.xsoh.etar`).
+- `tf(date)` gives a localized countdown ("fra 25 minuti"); `ci(..., 0)` is
+ the next calendar event; both need KWGT's calendar/location permissions.
+
+## Phone and KWGT environment
+
+- More than one adb device may be connected. Always target the phone
+ explicitly with `adb -s <serial>` (see `adb devices -l`, model Pixel); never
+ touch other devices.
+- KWGT's working folder was set to `Documents/KWGT`, so presets live in
+ `/sdcard/Documents/KWGT/Kustom/widgets/`. Its internal storage is not
+ readable over adb.
+- KWGT caches fonts by file name. When a font changes, bump its name
+ (`TallClock-v3.ttf` to `-v4`) and update `text_family` in the preset.
+- After pushing, the user must re-select the preset in the widget (presets,
+ Exported, tallclock, save); KWGT does not reload a changed file by itself.
+
+## Conventions
+
+- Keep the preset hand-editable JSON; scripts edit it with plain `json`.
+- Bundled fonts keep their own license file in `src/fonts/`; derived fonts
+ must carry a new name (OFL), `mkfont.py` renames to TallClock.
+- Placeholders only in code, docs, tests and commits.
+
+## Testing
+
+No test suite. Verify on the phone:
+
+```sh
+python3 -m json.tool clock/src/preset.json >/dev/null
+(cd clock/src && rm -f ../tallclock.kwgt && zip -qr ../tallclock.kwgt preset.json preset_thumb_*.jpg fonts/*.ttf)
+adb -s <serial> push clock/tallclock.kwgt /sdcard/Documents/KWGT/Kustom/widgets/
+# user reloads the preset, then:
+adb -s <serial> exec-out screencap -p > shot.png
+```
+
+## Repo facts
+
+- License: GPLv2 only (`LICENSE`, header in each script). Bundled fonts:
+ OFL (Oswald, Barlow Condensed) and Apache-2.0 (Material Symbols).
+- Work directly on master.