3.2 kB 49 lines
7e68a437
⋯
desktop/shell/LIVE-TILES.md
download raw history
at main Markdown

c8-shell: live tiles #

Part of the shell's notes (CLAUDE.md beside this file). The bus interface is protocols/org.cont8nuum.Tiles1.xml; the providers we ship are in desktop/widgets/ and each app's *-tile.

Live tiles are data, not surfaces: Start draws them. live.c serves org.cont8nuum.Tiles1 on the session bus (name owned by c8-shell; fields and templates are documented in protocols/org.cont8nuum.Tiles1.xml), keeps a tile's updates (untagged replaces all; up to 5 tagged rotate; one saying what the tile already shows only renews its expiry, unless it has pictures: same_update) in tiles.ini in the cache dir, and templates.c draws them per tile size (text, block, image, peek, images, stats). Providers (provider = in start.ini, Provider= in .widget files) are just programs the shell starts, which call the bus (c8tile from scripts, GDBus in c8-widget). c8tile restart ID|--all (bus Restart) relaunches providers after a new build: the shell emits Restarting, the old one exits, then it launches. starts=SECONDS on an update schedules it: it waits in live.pending (saved in tiles.ini, soonest first, 32 per tile) and is applied as if sent then, expires counting from that moment; a wake timer (reschedule) is only re-armed when its target time changes, since busy providers update constantly. RequestPin/Unpin make secondary tiles (an app's own tile that opens it at something: tile.secondary, saved in start.ini): the request is checked (one line, name <= 64, exec <= 400 bytes and not starting with @, both without characters that don't show or runs of spaces, honest_text, as the toast shows all of it; 4 waiting at most), then notify_ask (notify.c) shows a toast saying what the tile opens with Pin to Start / Not now, and the call returns when answered (20 s counts as no; the shell's own toasts, toast.ours, can't be replaced or closed over the bus). Only secondary tiles can be unpinned over the bus. c8tile pin/unpin do it from a shell. The imagetext template is a small picture with the words beside it. A tile needs no program: a .widget file with Command= in place of Provider= (and Interval= seconds, 60; Template=, text) gets the provider c8-widget script --file PATH %i from parse_widget (apps.c). script.c (c8-widgets) reads those keys from the file and runs the command through sh when Interval has passed, only while Start shows (its tick, every second; one run at a time, killed after TIMEOUT_S 30): plain lines are the heading (the block, for Template=block) then text1-6, lines of FIELD=VALUE (decided by the first line) the fields themselves; a failed or silent run leaves the tile as it was. --command/--interval/--template do the same from a start.ini line. desktop/widgets/examples/disk.widget and its README have it. Tested headless: plain lines and fields on Start, the three listed under Live tiles and one pinned from there. Untested: the timeout. A fresh shell (not a respawn) does the same for every tile once it owns the bus name, so a past session's providers go; a provider whose shell is gone 60 s (longer than c8's respawn backoff) quits by itself.