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;
|
||||
|
||||
# Script that suspends only when on battery power.
|
||||
# When plugged in, uses systemd-inhibit to block suspend.
|
||||
suspendScript = pkgs.writeShellScript "hypridle-suspend" ''
|
||||
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
|
||||
if [ "$(${pkgs.coreutils}/bin/cat /sys/class/power_supply/AC/online)" != "1" ]; then
|
||||
# On battery - suspend
|
||||
${pkgs.systemd}/bin/systemctl suspend
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue