Ensure we set performance profile on boot when on AC

This commit is contained in:
David Heinemeier Hansson
2026-04-15 18:14:07 +02:00
parent ce29e45ccd
commit a76757335a
3 changed files with 21 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
# Returns true if AC power is connected.
for ac in /sys/class/power_supply/AC* /sys/class/power_supply/ADP*; do
[[ -r $ac/online && $(cat "$ac/online") == "1" ]] && exit 0
done
exit 1
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
# Set the correct power profile on boot based on current AC/battery state.
# The udev rules only fire on state *changes*, so without this, booting
# on AC leaves you in the default balanced mode.
if omarchy-battery-present && ! omarchy-ac-present; then
omarchy-powerprofiles-set battery
else
omarchy-powerprofiles-set ac
fi
+1
View File
@@ -6,6 +6,7 @@ exec-once = uwsm-app -- swaybg -i ~/.config/omarchy/current/background -m fill
exec-once = uwsm-app -- swayosd-server
exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec-once = omarchy-cmd-first-run
exec-once = omarchy-powerprofiles-init
# Slow app launch fix -- set systemd vars
exec-once = systemctl --user import-environment $(env | cut -d'=' -f 1)