Files
omarchy/bin/omarchy-battery-present
David Heinemeier Hansson 9741b29a7c Describe the rest of the bins
2026-02-07 10:50:48 +01:00

14 lines
314 B
Bash
Executable File

#!/bin/bash
# Returns true if a battery is present on the system.
# Used by the battery monitor and other battery-related checks.
for bat in /sys/class/power_supply/BAT*; do
[[ -r "$bat/present" ]] &&
[[ "$(cat "$bat/present")" == "1" ]] &&
[[ "$(cat "$bat/type")" == "Battery" ]] &&
exit 0
done
exit 1