Architecture
A map of the source tree, and how one frame of the app runs.
Katlendar is one binary. The window is drawn by egui every frame from one App value. Anything slow (network, disk work that can wait) runs on a background thread and sends its result back.
One frame#
frame.rs draws a frame in this order:
poll_sync(insyncing/take.rs) takes in what background threads have finished, then starts any sync that is due.- The update check runs if it is due.
- Keys and mouse navigation are handled.
- The task panel, the toolbar and the calendar view are drawn, then any open window.
An edit changes Data in memory. App::save writes it to disk, and note_edits (in syncing/edits.rs) marks what must be sent to a server.
Background threads#
Every background thread starts through worker::spawn, which names it katlendar-<name>. The name shows up in a debugger and in crash reports, so pick one that says what the thread does.
The window never waits on the network or the keyring. Such work goes to a thread. App::in_background runs sync work that way: the thread sends each SyncDone message over a channel and wakes the window, which takes it in on the next frame. A thread that can't be started is reported instead of taking the app down.
Module map#
| Module | What it holds |
|---|---|
main.rs | command-line options, the data lock, window start-up |
app.rs | App: what is open, being edited or dragged, and the calendar actions the views and commands share |
frame.rs | one frame of the window, and the screenshot mode |
commands.rs | everything that can be asked for by key, menu or the command bar, and its shortcut |
views.rs | the main window: toolbar, task list and calendar views |
panel.rs | the task panel (left or right) and the bar above the calendar |
dialogs.rs | pop-up windows: the event and task editors, the new block window, shortcuts, the command bar, messages |
settings.rs | the settings window and its row helpers |
repeat_ui.rs | the repeat rows of the block window and the editors |
theme.rs | the palette, the colours that mean something, text sizes and corner radii |
fonts.rs | the fonts: the system's text font unless another is picked, with its emoji font behind it |
icons.rs | glyphs of the Lucide icon font (assets/lucide/lucide.ttf) |
motion.rs | every animation duration and easing |
ids.rs | egui IDs that are not scoped to one ui, with a test that none clash |
strings.rs | tr, trf, trn and the translations |
guide.rs | addresses in the guide, and the (i) buttons |
ics.rs | fetching and reading subscribed calendar feeds |
tz.rs | time zone names as servers write them, turned into IANA zones |
secrets.rs | the keyring |
update.rs | the update check |
platform.rs | what differs per system: where files are kept, how a link is opened |
worker.rs | named background threads |
testaid.rs | the KATLENDAR_* aids for pictures and checks |
model/ | data, preferences, saving and the task planner: see Data model |
sync/ | talking to each kind of server: see Sync |
syncing/ | the window's side of sync: opening accounts, starting work, taking in answers |
maps/ | tiles, the map widget, place search and the place picker: see Maps |
Where to look first#
- A new setting:
settings.rs, then a heading on the guide's settings page (see Guide links). - A new kind of account:
sync/, thensyncing/connect.rs. - Something on the calendar or in the task list:
views.rs, thenpanel.rs. - Something in the editors:
dialogs.rs, bothevent_formandtask_form.