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

358.19. kio-library-1.0.0

library:/, the offline library as a folder, its Places entry and the menu's Library category

Version 1.0.0, release 1
Source tree src/desktop/kio-library/
Phase 50_desktop (Desktop), 74 of 92 in build order
Licence MIT
Homepage https://github.com/kunaldawn/kdos
Build time 0.1 SBU
Installed size 213.9 KiB in 5 files
Recipe src/desktop/kio-library/kpkgbuild

About

kio-library makes the offline library a folder you can browse in Dolphin or any KDE file dialog. Its KIO worker, kio_library, serves library:/, whose five shelves list what is on this machine:

Shelf What it lists
Books ZIM archives, the KDOS book and KDOS from Scratch
Maps Organic Maps’ .mwm files
Models llama.cpp’s .gguf models, whisper.cpp’s ggml-*.bin and Piper’s voices
Docsets Zeal’s .docset directories
Courses Kolibri’s channels

Each item shows its size, and opening it opens the file itself with the program the menu would choose. The data pack or package an item came from is the worker’s extra field Pack, which Dolphin does not display.

The worker writes nothing. It finds each item where its program keeps it:

A data pack names its items with a launcher it installs, carrying Categories=X-KDOS-Library;, X-KDOS-Library-Kind= one of the five shelves, X-KDOS-Library-Path= the item’s absolute path, and X-KDOS-Pack= its id. The launcher’s Name and Icon win over what the scan found, and the launcher is the item’s entry in the menu’s Library category, which /etc/xdg/menus/applications-merged/kdos-library.menu adds with its directory file kdos-library.directory. A declared directory holding an index.html opens the index.

kdos-library-place, run at every login from /etc/xdg/autostart, adds Library to the Places panel of Dolphin and every file dialog the first time, through KIO’s own Places model.

Why it is in KDOS

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

library:/, the offline library as a folder in Dolphin and the file dialogs.

Sources

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

Dependencies

Depends on: cmake, ninja, extra-cmake-modules, qt6-qtbase, kcoreaddons, ki18n, kio.

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 kio-library'

What kpkg does

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

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/kio-library
SRC=$SRC_ROOT/kio-library-1.0.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:

cmake -S "$PORT_SRC" -B build -G Ninja \
	-D CMAKE_INSTALL_PREFIX=/usr \
	-D KDE_INSTALL_LIBDIR=lib \
	-D KDE_INSTALL_LIBEXECDIR=libexec \
	-D CMAKE_BUILD_TYPE=Release \
	-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
	-D BUILD_TESTING=OFF \
	-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build

The switches, and why each is set:

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/kio-library, 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 kio-library-1.0.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/kio-library, and runs the triggers its paths call for.

Other files in the port directory, read by build.sh: CMakeLists.txt, menu/, src/, tests/.

Contents

Installed directories: /etc/xdg/menus/applications-merged.

Notes

An item’s pack is the first of these that names it: the launcher’s X-KDOS-Pack; the data pack whose graft, recorded in /var/lib/kdos/packs/pack-manifest, the item lies under; and the kpkg package whose file list in /var/lib/kpkg/db names it. Reading every package’s list is the slow part, so what was found, and what was looked for and not found, is kept in ~/.cache/kdos/library-owners and trusted until kpkg’s database directory changes. An item under the home is the user’s own and has no pack.

KIO seeds a new Places list with its own defaults and has no hook a distribution can add one through, so the Places entry is added by the user’s session, once. A marker, ~/.config/kdos/library-place, records it, so a user who removes the entry has it stay removed.

An item’s name in the URL is its file’s own name; a second file of the same name on one shelf is numbered, a.zim~2, as a file manager names a copy. A Piper voice is listed only with its .onnx.json beside it, since one without the other does not speak. KDOS_LIBRARY_ROOT, when set, is put in front of every system path, which is how the worker is pointed at a fixture tree.