Fix AC power udev rules failing silently at boot (#5275)

* Don't use the names here since they break the all-themes setup in omarchy-nvim

* Fix AC power udev rules to use systemd-run

* Migrate AC power udev rules to systemd-run

* Add --collect and stable unit names to systemd-run udev rules

* Add unit name, replace, and After ordering to power profile udev rules

* Remove invalid --replace flag from systemd-run power profile rules

* We don't need --replace becuase it's not needed

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
Marco
2026-04-15 10:28:42 +02:00
committed by GitHub
co-authored by David Heinemeier Hansson
parent 18ab342119
commit a49b8d255c
3 changed files with 8 additions and 4 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
if omarchy-battery-present; then
cat <<EOF | sudo tee "/etc/udev/rules.d/99-wifi-powersave.rules"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="$HOME/.local/share/omarchy/bin/omarchy-wifi-powersave on"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="$HOME/.local/share/omarchy/bin/omarchy-wifi-powersave off"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-wifi-powersave-on $HOME/.local/share/omarchy/bin/omarchy-wifi-powersave on"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-wifi-powersave-off $HOME/.local/share/omarchy/bin/omarchy-wifi-powersave off"
EOF
sudo udevadm control --reload
+2 -2
View File
@@ -12,8 +12,8 @@ if omarchy-battery-present; then
battery_profile="${profiles[1]}"
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}=="1", RUN+="/usr/bin/powerprofilesctl set $ac_profile"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service /usr/bin/powerprofilesctl set $battery_profile"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service /usr/bin/powerprofilesctl set $ac_profile"
EOF
sudo udevadm control --reload
+4
View File
@@ -0,0 +1,4 @@
echo "Fix AC power udev rules to use systemd-run"
source $OMARCHY_PATH/install/config/powerprofilesctl-rules.sh
source $OMARCHY_PATH/install/config/wifi-powersave-rules.sh