pointfichiers/bar/eww/scripts/power_profile

31 lines
575 B
Bash
Executable file

#!/bin/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)"