testsAndMisc/linux_configuration/scripts/periodic_background
Krzysztof kuhy Rudnicki e0f62d699a fix(wellbeing): split focus_mode_daemon to satisfy the 500-line limit
focus_mode_daemon.py has been 509 lines since 22e22c1, over the repo's
cap. It went unnoticed because the Python tests workflow only triggers on
python_pkg/** changes, so that commit never ran CI; the next commit to
touch python_pkg/ exposed it and turned main red.

Extract configuration, logging, notification, /proc process inspection and
the killers into _focus_mode_lib.py, leaving the daemon its policy: the
whitelist, the FocusMode state machine, and main(). log/notify move with
the process code that calls them, so the dependency runs one way and there
is no cycle. The helper is underscore-prefixed and registered in pylint's
init-hook path, mirroring the existing usage_report.py / _usage_report_*.py
sibling-import precedent.

The daemon runs from a symlink in /usr/local/bin, so a sibling import only
works if Python resolves that symlink before setting sys.path[0]; verified
that it does, and the installer symlinks rather than copies, so the sibling
travels with it. Confirmed against the running service: restarts clean and
resumes enforcing, process detection unchanged, status output matches the
pre-split version.

Structural only; no behaviour change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RG3eEn8rwZbcXaJrKJxdv8
2026-07-17 17:36:30 +02:00
..
digital_wellbeing fix(wellbeing): split focus_mode_daemon to satisfy the 500-line limit 2026-07-17 17:36:30 +02:00
hosts fix(hosts-guard): stop setup aborting silently, so the guards actually enable 2026-07-17 08:25:51 +02:00
i3-configuration feat(digital-wellbeing): time-boxed shutdown overrides + drift-proof i3blocks deploy 2026-07-10 21:57:05 +02:00
system-maintenance fix(maintenance): make repair failures loud instead of silently exiting 0 2026-07-17 08:17:51 +02:00
utils/android_guardian refactor(linux_configuration/scripts): split all scripts into single_use/ and periodic_background/ 2026-05-15 00:32:35 +02:00
check_and_enable_services.sh fix(wellbeing): clear every remaining error/warning; drop thesis_tracker 2026-07-17 08:58:43 +02:00
setup_periodic_system.sh fix(pacman): wrap makepkg so an orphaned db.lck can't hang makepkg -i 2026-07-17 07:46:31 +02:00