mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
Fix power profile auto-switching on USB-C only machines (#5444)
* Fix power profile auto-switching on USB-C only machines * Small nits * Stick with single unit name --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
co-authored by
David Heinemeier Hansson
parent
d80c98f025
commit
62f6980852
@@ -1,9 +1,13 @@
|
||||
if omarchy-battery-present; then
|
||||
cat <<EOF | sudo tee "/etc/udev/rules.d/99-power-profile.rules"
|
||||
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 $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set battery"
|
||||
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 $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set ac"
|
||||
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"
|
||||
EOF
|
||||
|
||||
# Ensure the daemon is running and starts on boot. The arch package preset
|
||||
# leaves it disabled, which would silently break profile switching.
|
||||
sudo systemctl enable --now power-profiles-daemon
|
||||
|
||||
sudo udevadm control --reload 2>/dev/null
|
||||
sudo udevadm trigger --subsystem-match=power_supply 2>/dev/null
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user