testsAndMisc/docs/superpowers/evidence/monitor-autoconfig-2026-11-11.json
Krzysztof kuhy Rudnicki 53da9b5a12 Monitors: best mode automatically on hotplug
systemd user service watches RandR output events and puts every
connected monitor at native resolution + max refresh, DP-0 primary
on the left, unplugged outputs switched off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWXa4ytX9adN7qpMAop
2026-11-11 15:41:26 +01:00

13 lines
2.1 KiB
JSON

{
"intent": "Every monitor kuhy connects runs at its native resolution and highest refresh rate automatically, with DP-0 primary on the left, without running xrandr by hand.",
"scope": ["linux_configuration/features/monitor_layout.py, monitor_autoconfig.py, setup_monitor_autoconfig.sh, systemd/monitor-autoconfig.service", "linux_configuration/tests/test_monitor_layout.py, test_monitor_autoconfig.py, conftest.py; meta/pyproject.toml pylint init-hook path", "Non-goal: reverting deliberate mode changes (games, manual xrandr); only connect/disconnect triggers a re-layout"],
"changes": ["monitor_layout.py: parses xrandr --query and plans one row: native size at max refresh, preferred primary leftmost, disconnected outputs holding a CRTC switched off; returns [] when already there", "monitor_autoconfig.py: systemd user service; RandR version handshake, listens for RROutputChangeNotify, settles 1 s, retries while a connected monitor lists no modes, logs and survives a failed xrandr", "setup_monitor_autoconfig.sh installs deps, the user unit (WantedBy graphical-session.target) and starts it"],
"verification": [
{"command": "python3 -m pytest linux_configuration/tests/test_monitor_layout.py linux_configuration/tests/test_monitor_autoconfig.py --cov=monitor_layout --cov=monitor_autoconfig --cov-branch", "result": "pass", "evidence": "23 passed, 100% line+branch coverage on both modules"},
{"command": "linux_configuration/features/setup_monitor_autoconfig.sh", "result": "pass", "evidence": "unit enabled and active; layout DP-0 3840x2160@144 + HDMI-0 2560x1440@143.98 left unchanged (dry-run plan empty)"},
{"command": "RandR probe with/without xrandr_query_version", "result": "pass", "evidence": "no events before the handshake, CrtcChange/ScreenChange events after it"}
],
"risks": ["Physical hotplug not exercised on the real machine (kuhy declined the replug check); relies on the NVIDIA driver emitting RROutputChangeNotify on connect"],
"rollback": ["systemctl --user disable --now monitor-autoconfig.service; git revert", "xrandr layout stays as last applied"]
}