macbook: re-enable touchpad when DWT service stops

Add ExecStopPost to write 0 to bcm5974's inhibited sysfs node,
so the touchpad is always restored even if the script is killed
mid-inhibit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-19 17:41:42 +01:00
parent 951ba2b850
commit b52f730889

View file

@ -45,6 +45,14 @@
Type = "simple";
Restart = "on-failure";
RestartSec = 3;
ExecStopPost = pkgs.writeShellScript "dwt-uninhibit" ''
for p in /sys/class/input/event*/device/name; do
if grep -q bcm5974 "$p" 2>/dev/null; then
echo 0 > "''${p%/name}/inhibited"
fi
done
true
'';
ExecStart = "${pkgs.python3.withPackages (p: [])}/bin/python3 ${pkgs.writeText "macbook-dwt.py" ''
import glob, os, select, struct, time