mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
Add power-connected/disconnected systemd targets
This commit is contained in:
parent
bc3a65ba93
commit
5972b65e95
5
root/etc/systemd/system/power-connected.target
Normal file
5
root/etc/systemd/system/power-connected.target
Normal file
|
@ -0,0 +1,5 @@
|
|||
Description=Power adapter is connected (charger plugged)
|
||||
Conflicts=power-disconnected.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
6
root/etc/systemd/system/power-disconnected.target
Normal file
6
root/etc/systemd/system/power-disconnected.target
Normal file
|
@ -0,0 +1,6 @@
|
|||
[Unit]
|
||||
Description=Power adapter is disconnected (charger NOT plugged)
|
||||
Conflicts=power-connected.target
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
2
root/etc/udev/rules.d/50-powersave-adapter.rules
Normal file
2
root/etc/udev/rules.d/50-powersave-adapter.rules
Normal file
|
@ -0,0 +1,2 @@
|
|||
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/bin/systemctl start power-connected.target"
|
||||
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/bin/systemctl start power-disconnected.target"
|
Loading…
Reference in a new issue