pointfichiers/bar/eww/scripts/power_profile
2024-09-20 18:45:02 +02:00

31 lines
583 B
Bash
Executable file

#!/usr/bin/env dash
profile="$(powerprofilesctl get)"
formatprofile() {
p="$(echo "$1" | sed 's/power-saver/quiet/g')"
echo "$(echo "$p" | sed 's/.*/\u&/')"
}
if [ "$1" = "next" ]; then
case "$profile" in
performance)
powerprofilesctl set power-saver
;;
balanced)
powerprofilesctl set performance
;;
power-saver)
powerprofilesctl set balanced
;;
*)
echo "Unknown power profile"
exit 1
;;
esac
profile="$(powerprofilesctl get)"
eww update power_profile="$(formatprofile $profile)"
fi
echo "$(formatprofile $profile)"