lightsystemdarkgreen
@ 260802.2

210903.2 e5c0502664d30537deb1c8f33164d2bee5fb527f bin/battery: clean up battery handling

My new Framework laptop has its battery at 'BAT1', and it looks like 'status' might be 'Discharging' even when it's plugged in. So we make things a little more robust to this kind of variability.

reading declarations

Changes to bin/batpath. All files

bin/batpath

new file mode 100755@@ -0,0 +1,11 @@+#!/bin/sh++for name in BAT0 BAT1; do+  dir="/sys/class/power_supply/$name"+  if [ -f "$dir/status" ]; then+    echo "$dir"+    exit 0+  fi+done+echo "no battery detected" >&2+exit 1