c8-weather #
Weather: forecasts, radar and NWS alerts from weathersnail.com, places kept on a snail.zone account, and c8-weather-tile for its live tile.
Depends on: c8ui, gio, gdk-pixbuf, pangocairo, curl (run time).
org.cont8nuum.Weather, one copy (c8ui_app_main), after Windows 8's
Weather. Data from weathersnail.com's public API (the NWS's forecasts,
stations, alerts and radars, so the US; outside it /api/forecast is a
404 and the place shows why, but conditions still come). Shared core
(weather-core, no window system, also in the tile provider):
store.c (~/.config/cont8nuum/weather.ini: [weather] units f|c,
home, the places' order, a [place ID] each; local ids are c8- + 10
hex of SHA1 of "lat,lon"; the cache in ~/.cache/cont8nuum/weather/),
http.c (curl as a subprocess, the request on stdin, ws_download
writes .part then renames), data.c (POST /api/forecast per place
and units, cached per place; POST /api/conditions batched 50 at a
time, 10 km; GET /api/alerts?compact=true every 5 min at most, its
delta-coded shapes decoded (floats; walked, not indexed: json_at in
a loop made it quadratic, 1.9 s of CPU each time) and matched to each
place by point in polygon, marine and cancelled ones dropped, one per event, worst first;
ws_alert_text, ws_find_places over /api/places), format.c
(NWS icon codes to Start's glyphs, METAR present weather in words and as
the icon now, feels like by the NWS's wind chill and heat index, units,
the sky colours per glyph), account.c (with a c8-accounts
weathersnail account, the places are its markers: GET/PUT/DELETE /api/account/markers, 401 asks for a fresh token once, the local
places are put on it the first time, remembered in
~/.local/share/cont8nuum/weather/account.ini), tile.c (Start's
forecast template: the home place to org.cont8nuum.Weather and the
c8-weather widget's tile, each place to its secondary tile
org.cont8nuum.Weather.ID if pinned; an alert in force goes in the
text). c8-weather-tile TILE-ID (provider.c, Provider= of
c8-weather.widget) refreshes every 15 min and quits on Restarting,
unpin, or the shell gone a minute.
The app (main.c): a sky (gradient per the glyph now, darker at night,
sun glow, stars or clouds; c8ui_kept_draw) under a stack; Home is a
hub: the place, temperature, summary, feels like, wind/humidity/dew
point/barometer, the worst alert as a band (click: its page), the days
as columns (a click or Enter: the NWS's words in a flyout), then Alerts
(if any), Hourly forecast (kept list), Maps (radar.c: /api/maps's
light mosaic, downloaded and decoded on a thread, the place names from
its labels GeoJSON drawn once into an overlay with pangocairo, biggest
first, none overlapping; the tile is cropped round the place) and
Forecast details. Home is rebuilt only when home_shape changes (place,
forecast there or not, the alerts), else redrawn in place. Pages over it
(Escape/back): Places (a grid of sky tiles, the default first, Add a
place), the radar to pan both ways and zoom (pinch, Ctrl+wheel,
Ctrl+plus/minus/0; g.map_zoom, out to just covering the page, in to
4×, about the fingers or pointer) with a legend, an alert (text
reflowed). Nav bar: Home, Places, Maps (glyphs in data/glyphs,
installed to share/c8-weather); app bar: add to/remove from places,
set as default, Pin to Start (RequestPin, exec c8-weather weather:place/ID), Change to Celsius/Fahrenheit, Refresh. No places:
a welcome page with the search box (suggestions from /api/places,
Enter adds, leaving the box doesn't: c8ui_entry_set_enter_only). Search charm: places, then the
API's (a preview until added); Settings charm "Options": units, the
account, Refresh. Narrow: one vertical column (the hub with
c8ui_hub_set_narrow_column; the days as rows, 24 hours), short Places
tiles, the same pages; built once, the boxes' narrow paddings and
spacings and narrow() (the root's state) in the draw fns, resized
only sets cell sizes and the hourly count (relayout is stealth's).
Tested headless 2026-12-01: Home snapped (column, hourly, map,
details), unsnapped back to the section showing, Places both ways. F5/Ctrl+R refresh, Menu the
bars. Tested headless, wide and at 480: Home, the days flyout, Places,
an alert's page, Maps, the welcome page and adding a place, Celsius,
the pin question. Untested: answering the pin, the tile on Start, the
account's markers (no account here), mouse and touch, the Search charm.
Stealth mode (c8_stealth, c8-base): every place's name shown is
ws_place_label (a made-up town, C8_STEALTH_PLACE; weather.ini keeps
the real one, which is still what's fetched): Home, Places, the radar's
title, the remove question, the Search charm's own places (matched on
the shown name) and the live tiles. Hidden in it: the station's name,
the alerts' counties, the alert page (headline, text, office: one line
says why), the NWS office under the details, and the radar map itself
(map_for NULL, "The radar is hidden in stealth mode."), as its streets
say where. The account's nickname shows as the persona's name. Flips:
the app relayouts (stealth_changed), the tile provider pushes again.
Not changed: the name given to RequestPin (it is saved in start.ini)
and API search results (typed then). Tested headless, wide and at 480:
Home, the radar page, the tile on Start, flipping it live both ways.
Untested: Places, alerts, the Search charm, the Options account line.