# c8-cirrus

Cirrus, an app for Bluesky (the name and icon are ours: none of their branding): the app (a panorama hub of feeds, threads, profiles, writing posts) and `c8-cirrus-tile` for its live tile and toasts.
Depends on: c8ui, gio, gdk-pixbuf, libsecret, curl (run time).

`org.cont8nuum.Cirrus`, binary `c8-cirrus`, one copy
(`c8ui_app_main`): an app for Bluesky. "Bluesky" is their name: it is
said only where the service is meant (the sign-in text, the desktop
entry's comment), never as the app's name, id or icon. The calls and record shapes were checked against
Bluesky's lexicons (`com.atproto.*` in bluesky-social/atproto's
`lexicons/`, `app.bsky.*` in bluesky-social/bsky's): read them again
before adding a call, they change (the `gallery` embed and the 2 MB
picture limit were news). Shared core (`cirrus-core`, no window system,
also in the tile provider): `store.c` (`~/.config/cont8nuum/cirrus.ini`:
the accounts, DID, handle and server each, which is in use, the options;
no secrets), `session.c` (signing in with an app password: the handle's
`/.well-known/atproto-did`, else `resolveHandle` on public.api.bsky.app,
then the DID's document from plc.directory or did:web says the server;
an email goes to bsky.social, and the form's Server box skips all that;
`createSession`'s two tokens are in the wallet through libsecret, schema
`org.cont8nuum.Cirrus.Session` by DID, every wallet call given up after
20 s; `sky_get`/`sky_post`/`sky_upload` go to the account's server, are
held until the tokens are read, and one refused with `ExpiredToken` or
`InvalidToken` is sent again once after `refreshSession`, before which
the wallet is looked at: the app and the provider share the tokens and
the other may have renewed them; a refresh refused marks the account
`expired` and the sign-in form shows again; `sky_generation` goes up
with every change of account and answers for an older one come back as
status 0 with no error), `model.c` (posts: one struct per address in a
table, refcounted, so a like shows in every list; embeds: images,
gallery (its first four), external, video, record, recordWithMedia;
feeds, threads flattened with depths (each post's answers oldest
first, depth first: the server's ranked order read as no order; the
parents and the post carry `chain_up`/`chain_down` for the line
between them, and a "Replies, oldest first" gap item comes after the
post), notifications whose posts come
from `getPosts`, people, profiles, the saved feeds of the preferences'
`savedFeedsPrefV2`; and a new post's record with facets for links,
@mentions (looked up first) and #tags by byte offsets), `image.c` (News'
picture cache, kept by bytes: 96 MB decoded, avatars asked for at the
CDN's `avatar_thumbnail` size), `tile.c` (the newest five posts of
Following as tagged updates, `peek` with a post's picture, `imagetext`
with its author's; the unread notifications as the badge).
`c8-cirrus-tile TILE-ID` (`provider.c`, `Provider=` of
`c8-cirrus.widget`): every 5 min, and when Start shows after a minute,
reads cirrus.ini again (the app may have changed accounts), the
timeline and `getUnreadCount`; when that goes up and `notifications` is
on it toasts what came since the time kept in
`~/.local/state/cont8nuum/cirrus/toasted-DID` (three, then "and N
more"; the first run only notes the time).
The app: `feeds.c` is a `struct feedview`, a list and where it comes
from (timeline, feed, list, author, search, people, followers, follows,
notifications, thread), loading a page at a time: the next when its
last entry, a "Loading more…" one, is drawn. It outlives its widgets
(the hub's are reused when the hub is built again). Entries are cards
of their own heights in a c8ui list of spans whose cell is a column
wide and 2 px high, a card taking the rows it needs (`spans`), kept
drawings (`c8ui_list_set_keep`). A page's list (`SHAPE_PAGE`) is one
column, `PAGE_COLUMN` (680) at most wide and the window's narrow: it used to be
as many columns as fit, filled in reading order, which scattered a
thread's answers and a feed's posts across them (don't go back to it).
A click that opens deselects (no border and tick left behind).
`cards.c` lays a card out once
(`lay`) for measuring, drawing and hit-testing (`card_hit`: author,
reply, repost, like, a picture, the video, a link card, the quoted
post, a link of the focused post, Follow), which `opened` asks with
`c8ui_list_open_point`. The words sit beside the face; pictures (cut
to 300 high in a list, never made narrow), a link's card, a quoted post
and the action row go across the whole card, except on a post a
thread's line runs down through (`chain_down`), whose content stays
right of it. A reply has a rail left of it for each post it is under
(`INDENT` 20 a level, 4 at most) and a tick to its card
(`draw_lines`), so a subtree hangs together down the column. Text is drawn plain; the post a thread is about
lists its links under its words. `home.c`: wide, a true Metro
panorama (`c8ui_hub`, its own spacing, title "Cirrus"): a hero, a
carousel of the newest Following posts with pictures (`SLIDES_MAX` 6;
the newest post on blue when none has one), each drawn as News draws a
story's tile: the picture cover-filled, a shade from above the words,
the author, the whole post (as many lines as 60% of the height holds)
and its reply, repost and like counts in white. It slides on every
`SLIDE_S` (7 s; not under the pointer or the keyboard, nor behind a
page), the new one pushing the old out over `SLIDE_MS`; square arrows
at its sides under the pointer and Left/Right step it; pips at the top
right. Two kept drawings (`kept[cur]` shown, the other going). A click
opens its thread, a right click chooses it. Then Following and Notifications as columns `COLUMN_W`
440 wide, Feeds (the pinned feeds and lists as 150 px tiles, and "All
feeds"), You (picture, name, counts, New post, Your profile, Search,
Accounts). Five sections, of their own widths, so the next one always
shows at the right edge. Each section's header (`hub_section_new`,
"Name ›"; no › and not focusable without a page to open) opens its page; one whose content scrolls swallows a wheel going
up or down so the hub doesn't pan at a list's end (Shift+wheel does).
The hero is 45% of the window (420 to 900), set again on a resize
(`home_resized`, `c8ui_hub_set_width`). Until 2026-12-01 the hub was columns filling the
window edge to edge, 10 px apart, one per pinned feed, TweetDeck's way:
the user found it bothered them without saying why; what was wrong
with it as Metro was no title, nothing showing past the right edge to
say it pans, every section the same, tight spacing. Don't go back to
that. A pivot for wide was tried that day too and undone. The home is
built once (`home_new`) for both widths: narrow, c8ui's hub turns
itself into a wrapping pivot titled Cirrus (the headers slide round,
the chosen one first: without it the user found switching dull) of the
named sections, Following, Notifications, Feeds, You; the hero has no
name, so it isn't there. A section's head ("Name ›") hides itself
narrow (`struct section`'s hook in home.c), the pivot's header saying
it; `hub_section_keep_head` keeps it (a trail's columns). Before
2026-12-01 narrow was a separate pivot built by main.c, with each
pinned feed a page of it; feeds are now reached from Feeds' tiles. Every page is the whole window, over
`g.deck` in `g.stack` (`ui_open_page` is `ui_push`), so the hub keeps
its scroll under it; Back and Escape pop one, Home closes them all.
Until 2026-12-01 wide pages went in a pane at the hub's right; the
user didn't like those flyouts: don't bring it back. A page
(`page_new`) is Metro's: the back button 40 in, the title in HEADER
(SUBHEADER narrow) at `PAGE_LEFT` 120, where the content starts too;
lists take a reading column there, the padding at their right
(`ui_pad`'s `PAD_COLUMN`) following the width. `ui_pad` gives a box
its wide and narrow paddings once (box narrow padding switches them);
only the `PAD_COLUMN` ones are kept and set again on a resize, a size
and not a rebuild. Every page is built once for both widths
and reflows (toolkit/c8ui/CLAUDE.md): the header's spacing and title style are
the box's and label's narrow ones. Until 2026-12-01 pages were built
apart wide and narrow and remade on the flip (`page_reflow`,
`page_set_remake`, `pages_reflow`), and a page whose remake wasn't
hooked in stayed wide in a snapped window: don't bring that back.
Feeds and threads are trails (pages.c, c8ui's Miller columns, at the
user's asking): a feed or list is About (getFeedGenerator or getList:
picture, "A feed by @…" opening the profile, description, likes or
people; the page takes its name, as an `at://` address alone says
only "Feed") then Posts; a post clicked in a trail's column opens its
thread as the next column (`trail_open_thread` from `ui_activate`,
quotes too), taking away the ones after, and stays marked as the way
on (`opened` in feeds.c; unmarked when the column after it closes).
A post opened from anywhere else is a trail of its own. Columns are
`TRAIL_W` 520 (`SHAPE_TRAIL`), each "Name" over it (`hub_section_new`)
with NARROW_PAD each side. Back and Escape close the last column above
the base (`trail_back`) before the page. Narrow, the last column only
(c8ui's Miller columns, by themselves), with its heading kept, and a
feed's About over its posts in one column: `mover` (pages.c), a widget
whose hook moves the About box into the posts' column narrow and back
into its own column wide. Search, followers and the
like are a trail of one column.
Likes, reposts and follows are records made and deleted
(`ui_create_record`/`ui_delete_record`), shown at once and put back if
refused. The minute timer redraws for the ages and asks
`getUnreadCount`; more than before reloads Notifications without
`updateSeen` (only loads the user asked for say they were seen, so the
provider's toasts and badge still tell when the window is behind
others). `pages.c`: the trails (above), a profile (the name as
the page's title; wide a panorama, Windows Phone's people hub, at the user's
asking: About (banner, face, handle, bio, Follow, followers, More:
mute, block, copy link) 380 wide, then Posts, Replies and Media each a
column, three feedviews, each a named hub section; narrow the hub is
c8ui's pivot of About, Posts, Replies and Media, nothing built again). Media is tiles, as the
user asked (`fv->tiles`, `view_set_tiles`): the list a grid of squares
three across its width, each post's first picture or video's frame
(a count or ▶ in the corner; its words on blue when pictures are off),
one opening the viewer or playing; `draw_item` hands over to
`draw_tile` since a c8ui list's draw fn is set only when it's made, search
(Top, Latest, People), Feeds (saved ones and your own lists), Accounts
with the sign-in form (also the whole window with no account or an
ended session), the picture viewer (`c8ui_flip`). `compose.c`: new
post, reply (R), quote (Q), up to four pictures through the portal's
picker, each made a JPEG on a thread (upright, 2000 px and 1.9 MB at
most, so no camera data goes out), uploaded one by one, then the
record; leaving a half-written post asks. A video opens in the default
video app by its playlist address. App bar: Reply, Repost, Quote, Like,
Open in browser, Copy link, Delete (your own); New post (Ctrl+N),
Refresh (F5). Keys on a chosen post: L, T, R, Q; Ctrl+F search. Search
charm: people as you type, Enter searches posts; Settings charm:
Options (pictures, sensitive pictures, text size, notifications) and
Accounts. Arguments: `at://` addresses and bsky.app links open here.
`tools/mock-pds.py` stands in for an account's server: sessions and
writes are its own (it prints each record and checks a post's against
the lexicon), tokens end after `MOCK_EXPIRE` calls, everything read is
passed on to public.api.bsky.app, so the posts are real; with
`C8_ACCOUNTS_ALLOW_HTTP` and c8-online's `secrets-mock.py` on a private
bus. Tested that way headless, wide and at 480: a thread (its
order and lines, a parent chain, Escape, a column header), signing in, the hub
(1600 and 1280 wide: title, hero, peeks, wheeled to the end, a feed's
tile and the hero opening their pages, the carousel turning by itself,
holding still under the pointer, its arrows, a long post over a light
picture, You's counts and its four
buttons, a hero with no picture (`images=false`), Tab through the hero,
headers and lists with the hub panning to each, Enter on a header;
untested: touch), the profile's panorama (1600)
and column (480), and reflowed both ways by snapping and unsnapping
(Super+Left, Super+Down; again after the one-build change, 2026-12-01:
home hub to pivot and back, landing at the start or on the pivot's
section, profile panorama to pivot with header clicks, a feed's About
moving over its posts, an open post column kept), trails (2026-12-01, 1600 and snapped:
a feed's About and Posts from an `at://` argument, a post and then a
reply opening columns and panning to them, Escape closing one and
unmarking its post, a quote opening beside its thread, a thread from
the hub, snapped to one column with the open post kept, the back
button stepping out to About over Posts, unsnapped back to two
columns; untested: touch and the touchpad panning them, a list's
About, Tab across columns), Media's tiles (both widths, one opening the viewer, back
to Posts), Left/Right on the hero, the narrow pivot's headers going round on a click, the charms (Search: people as you type, one opening
their profile, Enter opening post search with the words in
its box; Settings: Options toggled live into cirrus.ini, Accounts),
a thread, a profile, like and unlike, repost, follow, a post with a
mention, a link and a tag, a reply, a post with a picture and its
description (a token ending mid-upload), people search, Feeds,
Accounts, the viewer, an ended session, the provider's calls.
Untested: a real account (createSession and refreshSession against a
real server, the wallet's daemon), post search (the public API refuses
it without an account), the tile on Start and the toasts, quote posts,
delete, mute and block, switching between two accounts, a video
opening in c8-video, touch, the handle lookups past `/.well-known`. An `at://did:plc:…` argument
handed to the running copy opens its thread (tested; it used to
arrive as `at://did:0/…`, see c8ui's `uris_from_args`).
Stealth mode (c8-base's `stealth.h`, config.ini `[stealth] on`):
`shown.c` in the core is the only way what names an account signed in
here is drawn: `sky_shown_name`/`_handle`/`_avatar` (NULL: the letter
placeholder) keyed on the DID being one of `sky_accounts`,
`sky_shown_text` (`@handle` of ours in words, link labels, "Feed by
@…", made the persona's; kept strings), `sky_shown_reason` (an item's
`by_did`/`by_name`: "Reposted by", "Replying to"). Display only: the
structs, cirrus.ini and every call keep the real ones; don't change
the models instead. Our own profile shows no banner, picture or bio;
Copy link gives the DID. Accounts, the sign-out question, and the
re-sign-in form (left empty) too; the tile and toasts in the provider.
`c8_stealth_watch`: the app redraws the lists, profiles and Accounts
and sends the tile again; the provider sends the tile again. Not live
(made once): the viewer's title, the composer's "Replying to", Feeds.
Not covered: the wallet item's label "Cirrus (handle)", shown by the
wallet. Tested headless, wide and 480, with cirrus.ini's account set to
bsky.app's DID and handle against the mock (so its posts are "ours"):
own posts, reposted by, mentions in text, notifications, profile,
Accounts, sign-out question, toggling live (an in-place write of
config.ini; one replaced by rename, `sed -i`, wasn't heard), the
provider's Update calls by dbus-monitor. Untested: a real account,
two accounts, the tile drawn on Start, toasts.
Headless without the form: write cirrus.ini's account with the mock's
server, get tokens with curl from its createSession, and store
"refresh\naccess" in the mock wallet by libsecret (schema above). Not done: direct messages, video in the app, adding
people to lists, links coloured inside a post's text, threadgates,
moderation beyond hiding labelled pictures. Headless gotcha: `wlrctl
pointer move` into a screen corner brings up the shell's panels, which
eat the next click; move relatively and keep track.
