Files
funman300 0de20dcd12 power-profile: signal fan widget on profile change
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-10 17:55:54 -07:00

27 lines
808 B
Bash
Executable File

#!/bin/bash
if [ "$1" = "--menu" ]; then
CHOICE=$(printf "󰓅 performance\n󰕲 balanced\n󰌪 power-saver" \
| wofi --dmenu \
--prompt "Power Profile:" \
--width 260 \
--height 160 \
--hide-scroll \
--no-actions \
--insensitive \
| awk '{print $NF}')
[ -n "$CHOICE" ] && powerprofilesctl set "$CHOICE" && pkill -RTMIN+8 waybar && pkill -RTMIN+9 waybar
exit
fi
CURRENT=$(powerprofilesctl get)
case "$CURRENT" in
performance) ICON="󰓅" ;;
balanced) ICON="󰕲" ;;
power-saver) ICON="󰌪" ;;
*) ICON="" ;;
esac
printf '{"text": "%s %s", "tooltip": "Power profile: %s\\nClick to change", "class": "%s"}\n' \
"$ICON" "$CURRENT" "$CURRENT" "$CURRENT"