Skip to main content

Module settings

Module settings 

Source

Structs§

BreakKindSettings
A borrowed, per-kind view over the micro_* / long_* field pairs of a Settings. Built by Settings::for_kind to collapse the match kind { Micro => s.micro_x, Long => s.long_x, … } ladders that recur across scheduler/ into a single s.for_kind(kind)?.x read.
BreakSound
Per-break-kind audio configuration: mode + which bundled sound to play. sound_id is the numeric id from src/assets/sounds/credits.json, or the literal "custom" to use custom_path (a Supporter-pack feature).
DerivedCaches
Stable, per-settings-load derivations resolved once at load/update time instead of being recomputed on every 1Hz scheduler tick or break fire.
Settings
Single source of truth for one profile’s behaviour.

Enums§

BreakMode
How a break surfaces to the user, per break kind (micro_break_mode / long_break_mode). Maps 1:1 onto the runtime BreakDelivery enum via BreakMode::delivery; the split exists because Sleep hard-codes Overlay and never reads a BreakMode.
BreakSoundMode
What the overlay does with audio for a given break kind.
HintMix
Which hint pool a break kind draws from. Micro mixes physical and psychological; long mixes solo and social; Both concatenates the kind’s two pools. The vocabularies don’t overlap, so one enum covers both kinds — effective_*_hints only ever asks “is this the mix, or one of my two pools?”.
MonitorPlacement
Which monitor(s) an overlay break should appear on.
ScheduleMode
Which scheduling strategy fires a break kind (micro_schedule_mode / long_schedule_mode). Interval is the repeating timer, Fixed is wall-clock times, Both runs them together. Sleep has no interval/fixed split and never reads this.
UpdateChannel
Which release line the in-app updater follows.

Functions§

default_clock_format 🔒
default_long_hints 🔒
default_long_social_hints 🔒
default_micro_physical_hints 🔒
default_micro_psychological_hints 🔒
default_routine_max_difficulty 🔒
default_sleep_hints 🔒
default_tray_countdown_target 🔒
default_true 🔒
default_windowed_fraction 🔒
default_work_days_mask 🔒
Every weekday enabled (0b111_1111). The default for work_days_mask, so a settings.json written before the field existed loads as “work window applies on all seven days” — preserving the prior behaviour where the work window had no day-of-week distinction.
delivery_for
Resolve the delivery mode for the given break kind.
deserialize_routine_categories 🔒
Deserialise a *_routine_categories filter list permissively: unknown entries are dropped (each with a logged warning) instead of failing the whole profile load (#212). A wholly malformed value (not an array of strings) degrades to an empty list rather than failing the load — matching the difficulty handler’s tolerance. An empty result still means “all categories”.
deserialize_routine_max_difficulty 🔒
Deserialise a *_routine_max_difficulty permissively: an unknown or wrong-typed value (stale, hand-edited, or from a future build) falls back to RoutineDifficulty::default rather than failing the whole profile load (#212). Shares the deserialize_with_fallback helper with the other tolerant settings enums; kept as a field-level deserialize_with (not a type-level Deserialize impl) so content packs still parse routines through the strict derived Deserialize.
deserialize_with_fallback 🔒
Deserialise a lowercase-tagged enum permissively: read the raw string and map it through parse, falling back to T::default() with a single logged warning on any unknown/corrupt value.
effective_long_hints
The resolved long-break hint pool. See effective_micro_hints.
effective_micro_hints
The resolved micro-break hint pool.
is_windowed_mode
True iff the given break kind is currently configured for the Windowed delivery mode. Convenience wrapper around delivery_for.
resolve_long_hints 🔒
Pure resolver for the long-break hint pool, honouring long_hint_mix. Solo / Social filter to that pool; anything else (including Both) concatenates them in solo-then-social order. Cached by DerivedCaches.
resolve_micro_hints 🔒
Pure resolver for the micro-break hint pool, honouring micro_hint_mix. Physical / Psychological return only that pool; anything else (including Both) concatenates both in physical-then-psychological order. This does the allocating / concatenating work; DerivedCaches caches its result so the fire path doesn’t repeat it.
sanitize_custom_css
Defence-in-depth scrub for user-supplied CSS. Even with a strict CSP in place we belt-and-braces:
strip_css_comments 🔒
windowed_fraction_for
Resolve the windowed-overlay size fraction for a break kind: the per-kind override when set, otherwise the global windowed_fraction. The result is clamped to [0.1, 1.0] (matching crate::scheduler::overlay::centered_windowed_rect) so a corrupt on-disk value can’t size the overlay off-screen. Sleep has no override and falls back to the global value (it never renders windowed anyway).