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

# omarchy:summary=Returns true if external power is connected.

power_supply_path="${OMARCHY_POWER_SUPPLY_PATH:-/sys/class/power_supply}"

for supply in "$power_supply_path"/*; do
  [[ -r $supply/online && -r $supply/type ]] || continue
  type=$(<"$supply/type")
  [[ $type == "Mains" || $type == "USB" ]] || continue
  [[ $(<"$supply/online") == "1" ]] && exit 0
done

exit 1