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
|
if omarchy-battery-present; then
|
||||||
mapfile -t profiles < <(omarchy-powerprofiles-list)
|
mapfile -t profiles < <(omarchy-powerprofiles-list)
|
||||||
|
|
||||||
if [[ ${#profiles[@]} -gt 0 ]]; then
|
if [[ ${#profiles[@]} -gt 1 ]]; then
|
||||||
|
|
||||||
# Default AC profile:
|
# Default AC profile:
|
||||||
# 3 profiles → performance
|
# 3 profiles → performance
|
||||||
# 2 profiles → balanced
|
# 2 profiles → balanced
|
||||||
# 1 profile → profiles[0]
|
ac_profile="${profiles[2]:-${profiles[1]}}"
|
||||||
ac_profile="${profiles[2]:-${profiles[1]:-${profiles[0]}}}"
|
|
||||||
|
|
||||||
# Default Battery profile:
|
# Default Battery profile (balanced)
|
||||||
# 3 profiles → balanced
|
battery_profile="${profiles[1]}"
|
||||||
# 2 profiles → balanced
|
|
||||||
# 1 profile → profiles[0]
|
|
||||||
battery_profile="${profiles[1]:-${profiles[0]}}"
|
|
||||||
|
|
||||||
cat <<EOF | sudo tee "/etc/udev/rules.d/99-power-profile.rules"
|
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"
|
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/bin/powerprofilesctl set $battery_profile"
|
||||||
|
|||||||
Reference in New Issue
Block a user