Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

358.18. kdos-notice-0.1.0

The system's notices in Plasma: restarts after an update, CVEs, the trial slot, a rollback, memory kills, missing firmware; confirms a booted slot

Version 0.1.0, release 1
Source tree src/desktop/kdos-notice/
Phase 50_desktop (Desktop), 73 of 92 in build order
Licence MIT
Homepage https://github.com/kunaldawn/kdos
Build time 0.1 SBU
Installed size 130.0 KiB in 2 files
Recipe src/desktop/kdos-notice/kpkgbuild

About

kdos-notice tells the person at a Plasma session what the system knows and they do not. It is KDOS’s own C, a client of org.freedesktop.Notifications linked to basu and to nothing from Qt, started by the session’s autostart (/usr/share/kdos/xdg/autostart/kdos-notice.desktop, OnlyShowIn=KDE). Plasma draws each notice, keeps its history and honours Do Not Disturb.

Notice From Stays until dismissed
“Firefox ESR and Konsole were updated”, or “The desktop was updated” with Log Out kdos restarts --json yes
“3 known vulnerabilities in installed packages” kdos cve --json yes
“Running KDOS 0.2 on trial” kdos-bootctl status --json no
“Your last update didn’t start” kdos-bootctl status --json no
“firefox-esr in the box www was closed to free memory” status on /run/kdos-oomd.sock no
“This computer’s hardware needs firmware-nvidia”, with Install kdos firmware sync --dry-run --json yes
“Software chosen during install is not installed yet”, with Open Discover when a boxed selection waits /var/lib/kdos/apps-pending and /var/lib/kdos/groups-pending, with /ports/groups for the groups’ titles yes

The same binary run as kdos-notice --bless, from /etc/xdg/autostart/kdos-session-good.desktop, is the second mark of a confirmed boot: once org.kde.plasmashell has answered on the session bus for a minute without a gap or a restart, it calls io.kdos.Slots1.Bless() on kdos-sysupdated once and exits.

Why it is in KDOS

The comment above it in script/phases/50_desktop/packages.txt:

The system's notices in Plasma: restarts after an update, CVEs, the trial slot, a rollback, memory kills.

Sources

None: the port builds from its own directory, /kdos/src/desktop/kdos-notice.

Dependencies

Depends on: basu, kdos-tools.

Required by (1): kde-plasma.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/50_desktop/phase.env && kpkg install kdos-notice'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /kdos/src/desktop/kdos-notice.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/kdos-notice
SRC=$SRC_ROOT/kdos-notice-0.1.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

LIBS="$PORT_SRC/../../libs"

gcc $CFLAGS -O2 -std=gnu11 -D_GNU_SOURCE -Wall -Wextra \
	-I"$LIBS/libkbase" -I"$LIBS/libkxdg" $(pkg-config --cflags basu) \
	-o kdos-notice "$PORT_SRC"/*.c "$LIBS"/libkbase/*.c "$LIBS"/libkxdg/*.c \
	$(pkg-config --libs basu) $LDFLAGS

install -Dm755 kdos-notice "$PKG/usr/bin/kdos-notice"
install -Dm644 "$PORT_SRC/kdos-notice.desktop" \
	"$PKG/usr/share/kdos/xdg/autostart/kdos-notice.desktop"

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/kdos-notice, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf kdos-notice-0.1.0-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/kdos-notice, and runs the triggers its paths call for.

Other files in the port directory, read by build.sh: bless.c, decide.c, facts.c, json.c, kdos-notice.desktop, main.c, notice.h, state.c, tests/.

Contents

Installed programs: kdos-notice.

Notes

A notice is posted once per change of what it is about. Each kind reduces its facts to a key (the set of processes running replaced code, the set of findings, the boot and its slot, the failed slot) and posts only when the key differs from the one it last posted, which $XDG_STATE_HOME/kdos/notice keeps across logins: the same CVE list is not announced at every login, and a changed one replaces the old notification instead of stacking beside it. A notice whose state ends is withdrawn. A command that did not answer changes nothing, so a missing secdb never withdraws a CVE notice. The state file is read when kdos-notice starts, so deleting it announces everything once more at the next login.

Nothing polls a command. An inotify watch on /var/lib/kpkg/db and on /var/lib/kdos/update.json asks kdos restarts and kdos cve ten seconds after the last change, so an update of hundreds of packages is one look, and asks kdos firmware sync --dry-run then too, which withdraws the firmware notice once the ports it named are installed; one on /run/kdos/bootstate.json, the copy of the boot state kdos-bootctl publishes for users, asks kdos-bootctl. The one thing read on a timer is kdos-oomd’s kill count, a single line over its socket every ten seconds; the count when the session first asks is the baseline, so a kill before the login is not this session’s news. Everything is looked at twenty seconds after login, every six hours, and two seconds after a new owner takes org.freedesktop.Notifications.

A notification’s id is good only while the server that issued it runs. Plasma takes a replaces_id it never issued as the new notification’s own number, so replacing or closing an id from an earlier login, or from a plasmashell that has since restarted, would replace or close another program’s notification. kdos-notice forgets every id when it starts and when the server changes owner; a notice that was waiting for a person (restarts, CVEs, the software still to install) is then posted again to the new server, since a restarted plasmashell lost it.

The software notice covers both of the installer’s records.

groups-pending is read the way kdos update install --pending reads it, each line cut at its first space, tab or #, so the notice names exactly the groups that command would install.

What the notice says. Several groups take a one-line header: “3 KDOS application groups:” beside boxed selections, and “3 KDOS application groups wait.” alone, since the summary already says the software was chosen during the install and is not installed yet. One group’s sentence and the count alone say the groups chosen during the install “are not installed yet”, which is true both when a medium with no binary host only recorded them and when the binary host did not answer. The way to install them follows, “once a binary host answers”:

Membership is read from the group database with getgrouplist at every decision, as sudo reads it, and KDOS_NOTICE_ADMIN_GROUP names another group in place of wheel for the tests. With no boxed selection waiting there is no Open Discover button, since Discover does not list a group, and the icon is system-software-install rather than Discover’s.

How the body is laid out. The body is plain text: Plasma’s notification body is a small subset of HTML, so Markdown backticks would be drawn as backticks, and a title’s &, < and > go as entities.

When it changes. The notice is keyed on both files’ ids, not on the titles, so a tree whose title changed posts nothing new, and it is withdrawn when neither file names anything. Both are read again once the package database has been quiet for ten seconds, so the notice changes or goes within seconds of a --pending run. KDOS_APPS_PENDING, KDOS_GROUPS_PENDING and KDOS_NOTICE_GROUPS move the three files for the tests.

The actions are fixed argument vectors:

Action Runs
Details Konsole on kdos cve, or System Settings at System Versions for the trial and rollback notices
Show Programs Konsole on kdos restarts
Install Konsole on sudo kdos firmware sync, or on su -c 'kdos firmware sync', which asks for root’s password there, for an account outside wheel; the firmware notice’s body names the same command
Open Discover Discover at “Selected during install”
Log Out Plasma’s logout prompt, over D-Bus

A signal that claims to be the notification server’s is acted on only when its sender owns org.freedesktop.Notifications at that moment. The activation token the server sends before an action goes to the program it starts, so its window takes focus.

--bless follows the owner of org.kde.plasmashell, not only its answers: a shell that crashed and was restarted between two looks is a new owner, and its minute starts again. polkit grants io.kdos.slots.bless to the active local session alone and never with a prompt, so the call carries no interactive flag. A shell that does not manage a minute within fifteen minutes is given up on, and the slot’s attempt counter then rolls a trial back. A machine without kdos-sysupdated is not an error. The firewall’s “Allow on this network?” prompt is not this program’s: it is kdos-fwask, beside the Firewall settings page in kcm-kdos-firewall.