Katlendar Developer manual GitHub

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:

  1. poll_sync (in syncing/take.rs) takes in what background threads have finished, then starts any sync that is due.
  2. The update check runs if it is due.
  3. Keys and mouse navigation are handled.
  4. 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#

ModuleWhat it holds
main.rscommand-line options, the data lock, window start-up
app.rsApp: what is open, being edited or dragged, and the calendar actions the views and commands share
frame.rsone frame of the window, and the screenshot mode
commands.rseverything that can be asked for by key, menu or the command bar, and its shortcut
views.rsthe main window: toolbar, task list and calendar views
panel.rsthe task panel (left or right) and the bar above the calendar
dialogs.rspop-up windows: the event and task editors, the new block window, shortcuts, the command bar, messages
settings.rsthe settings window and its row helpers
repeat_ui.rsthe repeat rows of the block window and the editors
theme.rsthe palette, the colours that mean something, text sizes and corner radii
fonts.rsthe fonts: the system's text font unless another is picked, with its emoji font behind it
icons.rsglyphs of the Lucide icon font (assets/lucide/lucide.ttf)
motion.rsevery animation duration and easing
ids.rsegui IDs that are not scoped to one ui, with a test that none clash
strings.rstr, trf, trn and the translations
guide.rsaddresses in the guide, and the (i) buttons
ics.rsfetching and reading subscribed calendar feeds
tz.rstime zone names as servers write them, turned into IANA zones
secrets.rsthe keyring
update.rsthe update check
platform.rswhat differs per system: where files are kept, how a link is opened
worker.rsnamed background threads
testaid.rsthe 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/, then syncing/connect.rs.
  • Something on the calendar or in the task list: views.rs, then panel.rs.
  • Something in the editors: dialogs.rs, both event_form and task_form.

Improve this page on GitHub