Files
mw-pfeddersheim-workstation/ansible/roles/hyprland/templates/waybar_gpu_script.sh.j2
T
ja 2bf5f5c005 ansible: sync templates with live system state
- hyprland: add pulseaudio + custom/gpu modules to waybar
- hyprland: template hyprlauncher.conf
- hyprland: add keybinding updates (yazi, chrome, screenshots, reload)
- hyprland: add uwsm package, replace wofi with hyprlauncher
- hyprland: add waybar GPU monitoring script
- greetd: update tuigreet command to uwsm start
- vars: add uwsm, hyprlauncher; remove wofi; add screenshot tools
2026-05-21 09:10:24 +02:00

22 lines
612 B
Django/Jinja

#!/usr/bin/env bash
# Waybar GPU usage module - NVIDIA
set -euo pipefail
GPU=$(nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits 2>/dev/null | head -1 | tr -d ' ')
TEMP=$(nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader,nounits 2>/dev/null | head -1 | tr -d ' ')
if [ -z "$GPU" ]; then
echo '{"text": "GPU N/A", "percentage": 0}'
exit 0
fi
if [ "$GPU" -ge 80 ]; then
ICON=""
elif [ "$GPU" -ge 50 ]; then
ICON=""
else
ICON="󰢮"
fi
echo "{\"text\": \"${ICON} ${GPU}%\", \"tooltip\": \"GPU Usage: ${GPU}% | Temp: ${TEMP}°C\", \"percentage\": ${GPU}}"