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
34 lines
1.4 KiB
Bash
Executable File
34 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/bash
|
|
# ABOUTME: Waybar-Modul das die GPU-Auslastung als JSON ausgibt.
|
|
# ABOUTME: Wird von der Waybar custom/gpu-usage Config referenziert.
|
|
|
|
GPU_STAT=$(cat /sys/class/hwmon/hwmon*/device/gpu_busy_percent 2>/dev/null | head -1 || echo "0")
|
|
GPU_STAT="${GPU_STAT:-0}"
|
|
ICON="<span color='#69ff94' size='8pt' rise='1.5pt'>▁</span>"
|
|
|
|
if [ "$GPU_STAT" -lt 10 ]; then
|
|
ICON="<span color='#69ff94' size='8pt' rise='1.5pt'>▁</span>"
|
|
elif [ "$GPU_STAT" -lt 20 ]; then
|
|
ICON="<span color='#2aa9ff' size='8pt' rise='1.5pt'>▂</span>"
|
|
elif [ "$GPU_STAT" -lt 40 ]; then
|
|
ICON="<span color='#f8f8f2' size='8pt' rise='1.5pt'>▃</span>"
|
|
elif [ "$GPU_STAT" -lt 50 ]; then
|
|
ICON="<span color='#f8f8f2' size='8pt' rise='1.5pt'>▄</span>"
|
|
elif [ "$GPU_STAT" -lt 60 ]; then
|
|
ICON="<span color='#ffffa5' size='8pt' rise='1.5pt'>▅</span>"
|
|
elif [ "$GPU_STAT" -lt 70 ]; then
|
|
ICON="<span color='#ffffa5' size='8pt' rise='1.5pt'>▆</span>"
|
|
elif [ "$GPU_STAT" -lt 80 ]; then
|
|
ICON="<span color='#ff9977' size='8pt' rise='1.5pt'>▇</span>"
|
|
elif [ "$GPU_STAT" -lt 100 ]; then
|
|
ICON="<span color='#dd532e' size='8pt' rise='1.5pt'>█</span>"
|
|
fi
|
|
|
|
jq --unbuffered --compact-output -n \
|
|
--arg text "GPU $ICON" \
|
|
--arg alt "GPU $ICON $GPU_STAT%" \
|
|
--arg tooltip "GPU $ICON $GPU_STAT%" \
|
|
--arg class "gpustat" \
|
|
--argjson percentage "$GPU_STAT" \
|
|
'{text: $text, alt: $alt, tooltip: $tooltip, class: $class, percentage: $percentage}'
|