Drop fixed unit name from power-profile udev rule to prevent wakeup failures

On USB-C-only laptops, multiple power_supply udev events fire at once on
resume, and each tries to create the same --unit=omarchy-power-profile
transient unit, so all but the first fail with "unit already loaded" and log
an error on every wakeup. Drop the fixed unit name so each event gets an
auto-generated one; powerprofilesctl set is idempotent, so concurrent runs are
harmless, and --collect still garbage-collects each unit on exit.

Closes #6091.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Diego
2026-07-12 08:15:48 -07:00
committed by David Heinemeier Hansson
co-authored by Claude Opus 4.8
parent e891e5c22f
commit 749a8c0466
+2 -2
View File
@@ -1,7 +1,7 @@
if omarchy-battery-present; then
cat <<EOF | sudo tee "/etc/udev/rules.d/99-power-profile.rules"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set"
SUBSYSTEM=="power_supply", ATTR{type}=="USB", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", RUN+="/usr/bin/systemd-run --no-block --collect --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set"
SUBSYSTEM=="power_supply", ATTR{type}=="USB", RUN+="/usr/bin/systemd-run --no-block --collect --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set"
EOF
sudo systemctl enable power-profiles-daemon