diff --git a/hosts/galleria/home.nix b/hosts/galleria/home.nix index f6ad7aa..1d84068 100644 --- a/hosts/galleria/home.nix +++ b/hosts/galleria/home.nix @@ -4,6 +4,11 @@ ... }: { + # This desktop is permanently connected to AC power. + systemd.user.services.swayidle.Service.Environment = [ + "SWAYIDLE_ASSUME_AC=1" + ]; + services.kanshi = { enable = true; diff --git a/modules/services/swayidle/home/nixos.nix b/modules/services/swayidle/home/nixos.nix index 9ff909b..461540a 100644 --- a/modules/services/swayidle/home/nixos.nix +++ b/modules/services/swayidle/home/nixos.nix @@ -10,6 +10,8 @@ let brightnessState = "$XDG_RUNTIME_DIR/swayidle-brightness"; onBattery = pkgs.writeShellScript "swayidle-on-battery" '' + [ "''${SWAYIDLE_ASSUME_AC:-0}" = 1 ] && exit 1 + for supply in /sys/class/power_supply/*; do [ -f "$supply/type" ] || continue [ "$(< "$supply/type")" = "Battery" ] || continue @@ -45,7 +47,7 @@ let ''; suspend = pkgs.writeShellScript "swayidle-suspend" '' - if ${onBattery}; then + if ${onBattery} || ${isLocked}; then exec ${systemctl} suspend fi ''; diff --git a/modules/systems/nix/common.nix b/modules/systems/nix/common.nix index 270334e..0a656ff 100644 --- a/modules/systems/nix/common.nix +++ b/modules/systems/nix/common.nix @@ -13,6 +13,7 @@ "https://moons-dotfiles.cachix.org" "https://noctalia.cachix.org" "https://vicinae.cachix.org" + "https://ghostty.cachix.org" "https://cache.numtide.com" "https://codex-desktop-linux.cachix.org" ]; @@ -23,6 +24,7 @@ "moons-dotfiles.cachix.org-1:WHoroKiNScG2/dpxHHL1I0qVmvuQhJbEAP+DS2j9Rr0=" "noctalia.cachix.org-1:pCOR47nnMEo5thcxNDtzWpOxNFQsBRglJzxWPp3dkU4=" "vicinae.cachix.org-1:1kDrfienkGHPYbkpNj1mWTr7Fm1+zcenzgTizIcI3oc=" + "ghostty.cachix.org-1:QB389yTa6gTyneehvqG58y0WnHjQOqgnA+wBnpWWxns=" "niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g=" "codex-desktop-linux.cachix.org-1:nX/xy6AdK9hQE24A8ALGjkCKj2ObFmcnemiL5Cid4nk=" ];