/ de-omarchy / bin / omarchy-battery-present
swadhinbiswas Initial de-omarchy: Omarchy UI layer for Arch-based distros · 8/22/2026
9f393b2
13 lines · 256 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash

# omarchy:summary=Returns true if a battery is present on the system.

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