Move powerprofile setting to userland script

This commit is contained in:
David Heinemeier Hansson
2026-04-15 13:50:36 +02:00
parent 4a2511ad5d
commit f094c3acc0
2 changed files with 27 additions and 18 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
# Set the power profile to the requested level, falling back to balanced
# if the requested profile isn't available on this machine.
#
# Usage: omarchy-powerprofiles-set <ac|battery>
mapfile -t profiles < <(powerprofilesctl list | awk '/^\s*[* ]\s*[a-zA-Z0-9\-]+:$/ { gsub(/^[*[:space:]]+|:$/,""); print }')
case "$1" in
ac)
# Prefer performance, fall back to balanced
if [[ " ${profiles[*]} " == *" performance "* ]]; then
powerprofilesctl set performance
else
powerprofilesctl set balanced
fi
;;
battery)
powerprofilesctl set balanced
;;
esac