pointfichiers/bar/eww/scripts/power_profile

32 lines
575 B
Text
Raw Normal View History

2024-01-25 14:39:08 +01:00
#!/bin/dash
profile="$(powerprofilesctl get)"
formatprofile() {
p="$(echo "$1" | sed 's/power-saver/quiet/g')"
echo "$(echo "$p" | sed 's/.*/\u&/')"
}
2024-01-25 14:39:08 +01:00
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)"
2024-01-25 14:39:08 +01:00
fi
echo "$(formatprofile $profile)"
2024-01-25 14:39:08 +01:00