diff --git a/bin/omarchy-battery-present b/bin/omarchy-battery-present new file mode 100755 index 00000000..9d859c3c --- /dev/null +++ b/bin/omarchy-battery-present @@ -0,0 +1,10 @@ +#!/bin/bash + +for bat in /sys/class/power_supply/BAT*; do + [[ -r "$bat/present" ]] && + [[ "$(cat "$bat/present")" == "1" ]] && + [[ "$(cat "$bat/type")" == "Battery" ]] && + exit 0 +done + +exit 1 diff --git a/install/config/all.sh b/install/config/all.sh index f7a1097b..f4ea88ba 100644 --- a/install/config/all.sh +++ b/install/config/all.sh @@ -19,6 +19,7 @@ run_logged $OMARCHY_INSTALL/config/fast-shutdown.sh run_logged $OMARCHY_INSTALL/config/sudoless-asdcontrol.sh run_logged $OMARCHY_INSTALL/config/input-group.sh run_logged $OMARCHY_INSTALL/config/omarchy-ai-skill.sh +run_logged $OMARCHY_INSTALL/config/powerprofilesctl-rules.sh run_logged $OMARCHY_INSTALL/config/hardware/network.sh run_logged $OMARCHY_INSTALL/config/hardware/set-wireless-regdom.sh run_logged $OMARCHY_INSTALL/config/hardware/fix-fkeys.sh diff --git a/install/config/powerprofilesctl-rules.sh b/install/config/powerprofilesctl-rules.sh new file mode 100755 index 00000000..e1b4da91 --- /dev/null +++ b/install/config/powerprofilesctl-rules.sh @@ -0,0 +1,26 @@ +if omarchy-battery-present; then + mapfile -t profiles < <(omarchy-powerprofiles-list) + + if [[ ${#profiles[@]} -gt 0 ]]; then + + # Default AC profile: + # 3 profiles → performance + # 2 profiles → balanced + # 1 profile → profiles[0] + ac_profile="${profiles[2]:-${profiles[1]:-${profiles[0]}}}" + + # Default Battery profile: + # 3 profiles → balanced + # 2 profiles → balanced + # 1 profile → profiles[0] + battery_profile="${profiles[1]:-${profiles[0]}}" + + cat <