Skip to main content

Module dnd

Module dnd 

Source
Expand description

The desktop’s do-not-disturb during Sioul’s pauses (sioul-app’s dnd.rs, docs/pauses.md): who serves the notifications, Plasma’s inhibition held for as long as a pause lasts, and dconf’s word that a GNOME setting changed. Linux and the BSDs; the session’s D-Bus.

Plasma lifts an inhibition when the connection that asked for it closes: each one is held by a thread of its own, which keeps that connection open until it is released or Sioul ends (a crash never leaves the desktop silenced), and asks again if Plasma’s notification server starts again.

Both ways (docs/do-not-disturb.md): the server’s Inhibited followed (watch_inhibited), each change told once it held a second and Sioul’s own change settled; dconf’s changes of a key told as they come (watch_dconf_told), for GNOME’s switch.

Structs§

Changes
The changes dconf tells to one key, heard while it lives: GNOME’s settings (and the person’s switches in its top bar) write through dconf, which says each change on the session bus. Dropped, it stops listening.
Inhibition
An inhibition of the desktop’s notifications (Plasma’s do-not-disturb, shown “While Sioul is active (reason)”), held until released or dropped.
Server
Who serves the session’s notifications, as it says.
Watch
The session’s do-not-disturb followed, as the notification server says it (Inhibited): each change that held a second, read again then, is told once Sioul’s own change settled (quiet: a time Sioul sets before each of its own changes). A new server (plasmashell started again) is read without telling: what it says then is nobody’s act. Dropped, it stops.

Constants§

BUS 🔒
The bus itself.
BUS_PATH 🔒
CALL_WAIT 🔒
How long a call to the server may take.
DCONF_WRITER 🔒
dconf’s writer, which tells every change to GNOME’s settings.
HELD 🔒
How long a change of Inhibited must hold before it is read again and told.
LISTENED 🔒
How long a holding thread listens before it looks at what Sioul asked.
PROPERTIES 🔒
D-Bus’s properties, whose PropertiesChanged says a change of Inhibited.
SERVER 🔒
The notification server, on the session bus.
SERVER_PATH 🔒
START_WAIT 🔒
How long a holding thread may take to start.

Functions§

follow_inhibited 🔒
has_owner 🔒
Whether a name has an owner on the bus, without starting one.
hold 🔒
An inhibition’s thread: asked for, held, asked again when the server starts again (a new server holds none), lifted when Sioul says or goes.
inhibit
Asks the notification server to hold notifications back while Sioul pauses: desktop_entry names the application (its desktop file, which Plasma shows by its name), reason the pause. Fails when the server has no such call or refuses; the error is the server’s.
inhibited
What the notification server says of Inhibited now: Plasma’s do-not-disturb as its notifications applet works it out (the person’s own, any application’s inhibition, a full-screen window, mirrored screens). None without a server, or one that does not say it.
listen 🔒
owner_of 🔒
The connection that owns a name now (“:1.42”); none when nobody does.
read_inhibited 🔒
said 🔒
A D-Bus error in a few words: its message, else its name.
server
The session’s notification server; none without a session bus, or when no server is running (asking would start one: D-Bus activation).
touches 🔒
Whether dconf’s change (prefix, and the paths under it that changed, “” for the prefix itself) touches key: the key itself, or a folder holding it reset whole.
watch 🔒
watch_dconf
Listens to dconf’s changes of key (“/org/gnome/desktop/notifications/show-banners”).
watch_dconf_told
Listens to dconf’s changes of key, and calls told at each, on the listening thread (it should hand any long work on).
watch_inhibited
Follows the server’s Inhibited, on a thread of its own: told(on) hears each change, on that thread (it should hand any long work on).