Focus mode flapped in and out of GAMING mode every few seconds and killed
browsers while no Steam was running. The pattern matching was not at
fault: the daemon was correctly seeing a process named "steam". That
process was a root-owned zombie.
A total gaming block on 2026-07-04 purged the Steam client and it was
never reinstalled, but steam-backlog-enforcer kept trying to launch it
through an orphaned /usr/local/bin/steam wrapper still pointing at the
deleted /usr/bin/steam. Each launch died on exec and, never being reaped,
lingered as a dead process that still carried the name "steam" - which
this daemon counted as a live Steam.
get_running_processes() now reads /proc/*/stat rather than /proc/*/comm
and skips state Z. Both cost one read per PID, so the poll loop stays
fork-free, but stat also carries the process state. _parse_stat() uses
rpartition(')') because a process name can itself contain spaces and
')', which naive whitespace splitting would corrupt. Names are truncated
to 15 chars in stat exactly as in comm, so the existing patterns match
unchanged.
Verified against the live zombie, before the enforcer was fixed:
zombies on system now : ['steam']
OLD (/proc/*/comm) sees 'steam' : True
NEW (zombie-filtered) sees 'steam' : False
dropped by filter : ['steam']
and non-regression on real processes: a synthetic live 'steam' and a
'steam_app_29687' game both still return True. It skips zombies, not
Steam. Running `focus-mode-daemon` now reports "Browser detected -
entering BROWSING mode" with no GAMING flapping.
The zombie source is fixed separately in steam-backlog-enforcer d54df3a;
this is the durable guard against any future one.
Note: install_focus_mode_daemon.sh copies rather than symlinks, so
/usr/local/bin/focus-mode-daemon was a stale copy without this fix.
Reinstalled. Editing this file alone never changes what runs.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013rN2usTS3pYLJqeVg2ZpgR
|
||
|---|---|---|
| .github | ||
| .hippo | ||
| .vscode | ||
| bucket_catch | ||
| docs | ||
| linux_configuration | ||
| meta | ||
| phone_focus_mode | ||
| python_pkg | ||
| third_party/agent-skills | ||
| .copilotignore | ||
| .fvmrc | ||
| .gitignore | ||
| .pre-commit-config.yaml | ||
| .prettierignore | ||
| CLAUDE.md | ||
| lint_python.sh | ||
| pyproject.toml | ||
| README.md | ||
| requirements.txt | ||
| run.sh | ||
testsAndMisc
A collection of personal projects, scripts, and experiments — from a GPS-based phone focus tool to Linux/Arch automation, with CI, linting, and pre-commit hooks across the board.
Highlights
Phone Focus Mode
Location-based app restriction for rooted Android. Automatically disables non-whitelisted apps within 500 m of home using ADB + Magisk. Features Haversine distance calculation, hysteresis to prevent toggling, fail-safe unlock, and state persistence. Bash, Android ADB.
Linux Configuration
Automated Arch Linux setup: fresh-install scripts, i3 window manager config, LaTeX environment, and system tests. Includes documentation and test result logging.
Scripts
Utility scripts for development workflows — build file validation, secret detection, and custom makepkg helpers.
Repository Layout
| Path | Description |
|---|---|
python_pkg/ |
Python packages (each maintained subpackage lives here) |
linux_configuration/ |
Arch Linux setup, i3 config, system maintenance scripts |
phone_focus_mode/ |
GPS-based Android focus enforcer |
scripts/ |
Workspace-level helper scripts and pre-commit hooks |
docs/ |
Reference docs and historical reports |
third_party/ |
Vendored upstream skills/agents |
meta/ |
Repo-wide tooling: pyproject.toml, requirements.txt, .pre-commit-config.yaml, run.sh, lint_python.sh, .fvmrc. Symlinked into the repo root so tools that auto-discover from root keep working. |
Archived / unmaintained projects live in the sibling repository
testsAndMisc-archive.
Tooling
- Python linting: Ruff with all rules enabled (see
meta/pyproject.toml) - Dependencies:
pip install -r meta/requirements.txt(combined runtime + dev) - CI: GitHub Actions — lint, build, and test on push
- Testing: pytest (Python), custom shell-based test harness for scripts