Expand description
Do-not-disturb on every device (docs/do-not-disturb.md): why it holds now, the switch pressed on any device, and the people who may reach you then.
- The reasons, each read from the one place that already says it, and
shared as it is: the pause and Free time (
quiet.toml), the night and naps (Health), a focus session (time/running.toml), and the switch (state/do-not-disturb.toml, the only new record). Every device reads the same files and comes to the same answer. The latest change wins: the switch pressed off after a reason began holds that reason off until it ends; a reason beginning after the press holds again. - The switch: each device writes its own table only, its last press stamped with a hybrid clock (never before a press already known), so a press made after seeing another always comes after it, whatever the clocks. Two presses that did not know of each other, less than a minute apart: “on” wins, the quieter choice; one more press settles it.
- The list, “Who may reach you during do-not-disturb”
(
config/dnd-people.toml): names, numbers and addresses, kept in the sharing itself, since the address books of two devices may not be in step. - Both ways: each device’s own do-not-disturb, turned on or off by
anything there and heard as it happens, presses the switch when it
disagrees with what holds there (
heard); the press says where it came from (via). A device whose switch “on” came from its own system alone adds no mode of Sioul’s over it (held_by_system), so that the end of what turned it on stays visible.
Structs§
- Device
- One device’s table in the switch’s file, written by that device alone.
- DndSettings
- What turns do-not-disturb on (
[dnd]in the configuration, shared with the settings). - Held
- A reason that holds now.
- Here
- This device, as
saidwords it. - Now
- Why do-not-disturb holds now: every reason that does, the one said first first.
- People
- “Who may reach you during do-not-disturb”.
- Person
- Someone who may reach you during do-not-disturb.
- Press
- The press that holds, as every device reads the switch.
- Said
- What the status line and the details say of do-not-disturb.
- Sources
- What each reason’s source says now (Unix seconds).
- Switch
- The switch’s file: a table per device.
Enums§
Constants§
- COMPUTER_
QUIET - A computer whose news is this old (seconds), its table saying it is
silenced, is waiting for its news: its Sioul may have stopped without a
word (a crash), and its system’s do-not-disturb (Plasma’s) ended with it. A
running computer exchanges each minute and writes its news at least every
fifteen minutes (sioul-sync’s
write_seen). A phone’s modes stay while Sioul is closed: its table holds. - FOCUS_
GRACE - A focus session holds do-not-disturb this long past the time chosen (seconds): a session forgotten never keeps you unreachable for long.
- FOCUS_
OPEN - …and a session without a time chosen, this long (Sioul’s open-ended ceiling).
- LIVE_
DAYS - Other devices heard from within this many days count for “on every device”.
- MARGIN_
MS - Two presses on two devices closer than this (milliseconds), neither knowing of the other: “on” wins. Clocks of devices that set their time from the network differ by less than a second; this covers a clock left a little off.
- PEOPLE_
FILE - The list’s file, in the configuration folder; shared with the senders (“config/dnd-people.toml”).
- SWITCH_
FILE - The switch’s file, in the state folder; shared with the settings (“state/do-not-disturb.toml”).
- VIA_
SYSTEM - A press heard from the device’s own do-not-disturb, as
Device::viaandPress::viasay it.
Functions§
- address_
key 🔒 - An address as compared: its address part (“Jane jane@example.org”), trimmed, in lower case.
- change_
own - This device’s own table changed under the file’s lock, the file read
again first: the other devices’ tables, brought by the sharing meanwhile,
stay as they are.
changesays whether it changed anything; nothing is written otherwise. A file that does not read is left alone, an error. - change_
people - The list changed under its lock, read again first: what the sharing brought meanwhile stays. A file that does not read is left alone, an error.
- focus
- A focus session as do-not-disturb reads it: counting (not paused), from its start until 30 minutes past the time chosen (three hours without one); none otherwise.
- from_
contact - Someone from a contact card: their name, numbers and addresses.
- from_
safe - People from the Safe list: each address, with its card’s name and numbers
when a card has it; everyone whose card is in a category on it
(
category:Friends); a card on it (contact:<UID>); a number on it (tel:+33…). Patterns (@example.org,*@example.org,tel:+3319900*) name nobody: counted, left. - heard
- A change of this device’s own do-not-disturb, heard as it happened, against
what holds here (
holds: do-not-disturb on, for any reason): the press it is,Some(on), when the two disagree; none when they agree, which is what Sioul’s own changes look like when they come back (docs/do-not-disturb.md, “Both ways”). A change found later, not heard as it happened, is never a press: its time is unknown, and another device may have pressed since. - held_
by_ system - Whether the switch’s mode is held on this device by its own system alone:
the switch’s “on”, taken from this device’s own do-not-disturb (
here,VIA_SYSTEM), is the only reason for that mode (the pause and Free time have modes of their own). Sioul then adds no mode of its own there: the system’s cause silences the device already, and a mode of Sioul’s would hide its end (Android shows an application only the effective state). - is_
false 🔒 - new_id
- A new id: the time and a hash keyed at random for this process.
- now
- Why do-not-disturb holds at
now(Unix seconds), from the reasons’ sources, the settings and the switch’s latest press. A press “off” made after a reason began holds that reason off until it ends; the pause first, then Free time (never with the pause), sleep, focus, the switch. - others
- Each other device that counts (heard from in the last
LIVE_DAYSdays, by the sharing:heard, its id and when, Unix seconds), and how it follows while do-not-disturb holds here, sincesince(milliseconds): a table written before that (by more thanMARGIN_MS, for clocks that disagree) says what held there before, not now.registeredsays whether a device has its entry in the devices’ registry (a Sioul that knows do-not-disturb). A computer as Sioul quit there is closed; a computer said silenced but not heard from forCOMPUTER_QUIETis waiting for its news (a crash says nothing). - said
- The words of do-not-disturb as it holds now: where (
here, this device and its system’s answer;others, asotherssays), until when (until, already worded: “15:00”, “tomorrow at 07:00”), why.name_ofnames a device by its id, inside a sentence (“your phone”, a computer’s name, “another device”). - take_
off - Someone blocked comes off Always through (docs/attention.md, Q3: blocked
beats Always through, and putting someone on one list takes them off the
other): their address and number taken off the people on the list, the
person of their card (
card, its UID) taken off whole; a person left with nothing to reach them by goes. Whether the list changed. - write_
whole 🔒 - A file written beside its place under a hidden name, then renamed.
- yes 🔒