pointfichiers/bar/i3status-rust/scripts/toggle-profile

33 lines
635 B
Text
Raw Permalink Normal View History

2023-10-29 13:56:07 +01:00
#!/bin/bash
get-profile () {
asusctl profile -p | awk '{print $4}'
}
get-profile-json () {
profile="$(get-profile)"
state="idle"
if [ "$profile" == "Balanced" ]; then
state="info"
elif [ "$profile" == "Performance" ]; then
state="warning"
fi
echo "{\"icon\": \"\", \"state\": \"$state\", \"text\": \"$profile\", \"short_text\": \"\"}"
}
active_profile="$(get-profile)"
if [ "$1" == "toggle" ]; then
if [ "$active_profile" == "Quiet" ]; then
asusctl profile -P Balanced
elif [ "$active_profile" == "Balanced" ]; then
asusctl profile -P Performance
else
asusctl profile -P Quiet
fi
fi
get-profile-json