Files
omarchy/install/config/powerprofilesctl-rules.sh
T
DiegoandClaude Opus 4.8 749a8c0466 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>
2026-07-12 08:15:48 -07:00

12 lines
664 B
Bash

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 --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
sudo udevadm control --reload 2>/dev/null
sudo udevadm trigger --subsystem-match=power_supply 2>/dev/null
fi