battery/ac target fixes (wip, still needs work)
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
};
|
||||
home.packages = with pkgs; [
|
||||
telegram-desktop
|
||||
legcord
|
||||
equibop
|
||||
obsidian
|
||||
];
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
@@ -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";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user