0de20dcd12
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
808 B
Bash
Executable File
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"
|