mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Don't apply power profile source switching if only one profile is available (#4485)
This commit is contained in:
committed by
GitHub
parent
8878478103
commit
4b3e21445b
@@ -1,19 +1,15 @@
|
||||
if omarchy-battery-present; then
|
||||
mapfile -t profiles < <(omarchy-powerprofiles-list)
|
||||
|
||||
if [[ ${#profiles[@]} -gt 0 ]]; then
|
||||
if [[ ${#profiles[@]} -gt 1 ]]; then
|
||||
|
||||
# Default AC profile:
|
||||
# 3 profiles → performance
|
||||
# 2 profiles → balanced
|
||||
# 1 profile → profiles[0]
|
||||
ac_profile="${profiles[2]:-${profiles[1]:-${profiles[0]}}}"
|
||||
ac_profile="${profiles[2]:-${profiles[1]}}"
|
||||
|
||||
# Default Battery profile:
|
||||
# 3 profiles → balanced
|
||||
# 2 profiles → balanced
|
||||
# 1 profile → profiles[0]
|
||||
battery_profile="${profiles[1]:-${profiles[0]}}"
|
||||
# Default Battery profile (balanced)
|
||||
battery_profile="${profiles[1]}"
|
||||
|
||||
cat <<EOF | sudo tee "/etc/udev/rules.d/99-power-profile.rules"
|
||||
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/bin/powerprofilesctl set $battery_profile"
|
||||
|
||||
Reference in New Issue
Block a user