battery/ac target fixes (wip, still needs work)

This commit is contained in:
2026-03-14 11:08:36 +00:00
parent 8229f20975
commit 0ceda0b675
2 changed files with 15 additions and 1 deletions

View File

@@ -8,6 +8,20 @@
SUBSYSTEM=="power_supply",ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/run/current-system/systemd/bin/systemctl start battery.target"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/run/current-system/systemd/bin/systemctl start ac.target"
'';
systemd.targets = {
"ac" = {
description = "On AC power";
unitConfig = {
StopWhenUnneeded = "yes";
};
};
"battery" = {
description = "On battery power";
unitConfig = {
StopWhenUnneeded = "yes";
};
};
};
};
};
}