All checks were successful
Update PKGBUILD version / update-pkgver (push) Successful in 2s
Q-01: Fix broken upower regex in moonarch-btnote (lookaheads never matched)
Q-02: Fix transform.sh paru repo section name ([moonarch] → [moonarch-pkgbuilds]),
config path (~/.config → /etc), and partial sync (-Sy → -Syu)
Q-03: Add missing stasis package to aur.txt (idle management broken on fresh install)
S-01: Switch CI git clones from HTTP to HTTPS (MITM risk in Docker network)
S-02: Restrict CI builder sudo to /usr/bin/pacman only
P-01: Refactor moonarch-waybar-gpustat — remove while loop, use jq --arg style
20 lines
710 B
Bash
Executable File
20 lines
710 B
Bash
Executable File
#!/bin/bash
|
|
# ABOUTME: Checks Bluetooth devices for low battery and sends a notification.
|
|
# ABOUTME: Can be run periodically via timer or cron.
|
|
|
|
NOTIFY_AT_PERCENTAGE=70
|
|
ICON="battery-empty"
|
|
|
|
while IFS= read -r d; do
|
|
[ -z "$d" ] && continue
|
|
DEVICE_DATA=$(upower -i "$d")
|
|
PER_INT=$(echo "$DEVICE_DATA" | grep -oP 'percentage:\s+\K[0-9]+')
|
|
DEVICE_NAME=$(echo "$DEVICE_DATA" | grep -oP 'model:\s+\K.+')
|
|
|
|
if [ -n "$DEVICE_NAME" ] && [ -n "$PER_INT" ] && [ "$PER_INT" -lt "$NOTIFY_AT_PERCENTAGE" ]; then
|
|
notify-send -t 5000 -e "Low battery $DEVICE_NAME $PER_INT%" -i "$ICON" \
|
|
-h string:x-canonical-private-synchronous:battery \
|
|
-h int:value:"$PER_INT" -u critical
|
|
fi
|
|
done < <(upower -e)
|