eww -> scripts -> power_profile: Now uses powerprofilesctl instead of asusctl

This commit is contained in:
GaspardCulis 2024-04-19 11:18:45 +02:00
parent f5bed6145b
commit 827c4f8c03
No known key found for this signature in database
GPG key ID: BC18146756955609

View file

@ -1,10 +1,31 @@
#!/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
asusctl profile -n
profile=$(asusctl profile -p | sed s:'Active profile is '::)
eww update power_profile="$profile"
else
asusctl profile -p | sed s:'Active profile is '::
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)"