Prevent undesirable suspends
hypridle only suspends if not connected to an external monitor and logind no longer suspends while charging
This commit is contained in:
parent
18b2f7165d
commit
e2460ca093
2 changed files with 10 additions and 3 deletions
|
|
@ -15,10 +15,11 @@ let
|
|||
|
||||
cfg = config.${namespace}.services.hypridle;
|
||||
|
||||
# Script that suspends only when on battery power.
|
||||
# Script that suspends only when not docked (no external monitors).
|
||||
suspendScript = pkgs.writeShellScript "hypridle-suspend" ''
|
||||
if [ "$(${pkgs.coreutils}/bin/cat /sys/class/power_supply/AC/online)" != "1" ]; then
|
||||
# On battery - suspend
|
||||
mon_count=$(${pkgs.hyprland}/bin/hyprctl monitors all 2>/dev/null | ${pkgs.gnugrep}/bin/grep -c '^Monitor' || echo "0")
|
||||
# If only 1 monitor (builtin), suspend. If 2+ monitors, assume docked - don't suspend.
|
||||
if [ "$mon_count" -le 1 ]; then
|
||||
${pkgs.systemd}/bin/systemctl suspend
|
||||
fi
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@
|
|||
|
||||
services.fwupd.enable = true;
|
||||
services.gvfs.enable = true;
|
||||
services.logind.settings.Login = {
|
||||
HandleLidSwitchDocked = "ignore";
|
||||
HandleLidSwitchExternalPower = "ignore";
|
||||
HandleLidSwitch = "suspend";
|
||||
KillUserProcesses = false;
|
||||
};
|
||||
|
||||
virtualisation = {
|
||||
docker = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue