Extract lib/donbox.sh #16

Closed
opened 2026-08-22 19:00:28 +01:00 by joshquinlan · 2 comments
Owner

die, warn, require_command, state/config/data paths, single_instance, inhibit, notify; replace the 28 private copies; static test against raw notify-send and command -v.

die, warn, require_command, state/config/data paths, single_instance, inhibit, notify; replace the 28 private copies; static test against raw notify-send and command -v.
Author
Owner

Done on branch core as d4da86d.

lib/donbox.sh provides die, warn, require_command,
donbox_config_dir, donbox_data_dir, donbox_state_dir,
donbox_runtime_dir (each taking an optional subdirectory and
creating what it names), single_instance (flock on a runtime
file), inhibit hold|drop|held (the systemd-inhibit wrapper the
old caffeine and lid each carried a copy of), notify,
run_detached and donbox_dispatch.

bin/donbox-notify and bin/donbox-notify-sound are ported
onto it as the first two consumers, and the router itself now
sources it rather than carrying its own die.
test/shell.d/bin-style-test.sh fails on a raw notify-send, a
hand-rolled command -v or a private die in bin/, and each was
watched failing on a planted offender.

The helpers are named donbox_*_dir rather than the
donbox_state in the older docs; CLAUDE.md, .claude/rules/bin.md
and the new-command skill were updated to match.

Done on branch `core` as d4da86d. `lib/donbox.sh` provides die, warn, require_command, donbox_config_dir, donbox_data_dir, donbox_state_dir, donbox_runtime_dir (each taking an optional subdirectory and creating what it names), single_instance (flock on a runtime file), inhibit hold|drop|held (the systemd-inhibit wrapper the old caffeine and lid each carried a copy of), notify, run_detached and donbox_dispatch. `bin/donbox-notify` and `bin/donbox-notify-sound` are ported onto it as the first two consumers, and the router itself now sources it rather than carrying its own die. `test/shell.d/bin-style-test.sh` fails on a raw notify-send, a hand-rolled `command -v` or a private die in bin/, and each was watched failing on a planted offender. The helpers are named `donbox_*_dir` rather than the `donbox_state` in the older docs; CLAUDE.md, .claude/rules/bin.md and the new-command skill were updated to match.
Author
Owner

Integrated on master (efeac8a): lib/donbox.sh with die, warn, require_command, XDG dir helpers, single_instance, inhibit hold|drop|held, notify, run_detached, donbox_dispatch; bin-style-test gates raw notify-send, command -v and private die; donbox pkg now sources it (5836e23).

Integrated on master (efeac8a): lib/donbox.sh with die, warn, require_command, XDG dir helpers, single_instance, inhibit hold|drop|held, notify, run_detached, donbox_dispatch; bin-style-test gates raw notify-send, command -v and private die; donbox pkg now sources it (5836e23).
Sign in to join this conversation.
No description provided.