From a76757335a3b4364cb4fd37edf33c1096e7c78ff Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 15 Apr 2026 18:14:07 +0200 Subject: [PATCH] Ensure we set performance profile on boot when on AC --- bin/omarchy-ac-present | 9 +++++++++ bin/omarchy-powerprofiles-init | 11 +++++++++++ default/hypr/autostart.conf | 1 + 3 files changed, 21 insertions(+) create mode 100755 bin/omarchy-ac-present create mode 100755 bin/omarchy-powerprofiles-init diff --git a/bin/omarchy-ac-present b/bin/omarchy-ac-present new file mode 100755 index 00000000..a2f632a9 --- /dev/null +++ b/bin/omarchy-ac-present @@ -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 diff --git a/bin/omarchy-powerprofiles-init b/bin/omarchy-powerprofiles-init new file mode 100755 index 00000000..5a94d05b --- /dev/null +++ b/bin/omarchy-powerprofiles-init @@ -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 diff --git a/default/hypr/autostart.conf b/default/hypr/autostart.conf index 40522822..b9d1b491 100644 --- a/default/hypr/autostart.conf +++ b/default/hypr/autostart.conf @@ -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)