mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
21 lines
538 B
Bash
Executable File
21 lines
538 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Set the power profile to the requested level, falling back to balanced
|
|
# omarchy:args=<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
|