Fixed sleep when plugged in
Some checks failed
Build NixOS Configurations / build (carbon) (push) Has been cancelled
Build NixOS Configurations / build (git) (push) Has been cancelled
Build NixOS Configurations / build (gospel) (push) Has been cancelled
Build NixOS Configurations / build (node) (push) Has been cancelled
Some checks failed
Build NixOS Configurations / build (carbon) (push) Has been cancelled
Build NixOS Configurations / build (git) (push) Has been cancelled
Build NixOS Configurations / build (gospel) (push) Has been cancelled
Build NixOS Configurations / build (node) (push) Has been cancelled
This commit is contained in:
parent
549d9ee251
commit
99061b65da
1 changed files with 1 additions and 5 deletions
|
|
@ -16,12 +16,8 @@ let
|
||||||
cfg = config.${namespace}.services.hypridle;
|
cfg = config.${namespace}.services.hypridle;
|
||||||
|
|
||||||
# Script that suspends only when on battery power.
|
# Script that suspends only when on battery power.
|
||||||
# When plugged in, uses systemd-inhibit to block suspend.
|
|
||||||
suspendScript = pkgs.writeShellScript "hypridle-suspend" ''
|
suspendScript = pkgs.writeShellScript "hypridle-suspend" ''
|
||||||
if [ "$(${pkgs.coreutils}/bin/cat /sys/class/power_supply/AC/online)" = "1" ]; then
|
if [ "$(${pkgs.coreutils}/bin/cat /sys/class/power_supply/AC/online)" != "1" ]; then
|
||||||
# Plugged in - inhibit suspend
|
|
||||||
${pkgs.systemd}/bin/systemd-inhibit --what=sleep --who=hypridle --why="AC power connected" --mode=block ${pkgs.coreutils}/bin/sleep infinity &
|
|
||||||
else
|
|
||||||
# On battery - suspend
|
# On battery - suspend
|
||||||
${pkgs.systemd}/bin/systemctl suspend
|
${pkgs.systemd}/bin/systemctl suspend
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue