Automatically switch power profile when plugged in (balanced) and unplugged (power saver) (#4375)

* Set Power Profiles Rules when plugged in (balanced) and unplugged (power-saver)"

* Check for battery presence before installing power profile rules

* Add battery presence check script and update powerprofilesctl rules

* fix indentation

* Simplify power profile rule creation logic
This commit is contained in:
Pierre Olivier Martel
2026-01-29 11:37:18 -05:00
committed by GitHub
parent ec305459f8
commit f78f5b2c2c
4 changed files with 40 additions and 0 deletions

10
bin/omarchy-battery-present Executable file
View File

@@ -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