From d5908085c462f3ca79ea798c3b8b7fdcbb170d38 Mon Sep 17 00:00:00 2001
From: Jens Nolte <git@queezle.net>
Date: Sun, 22 Aug 2021 13:52:28 +0200
Subject: [PATCH] Make autolock before suspend configurable

---
 modules/sway/config.nix  | 2 +-
 modules/sway/default.nix | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/sway/config.nix b/modules/sway/config.nix
index 98fb9e8..c11c6af 100644
--- a/modules/sway/config.nix
+++ b/modules/sway/config.nix
@@ -129,7 +129,7 @@ bindsym Ctrl+Shift+Print exec grim -g "$(slurp)"
 
 # suspend
 bindsym $mod+Print exec systemctl suspend
-exec swayidle -w before-sleep "swaylock -f -i $lockscreen"
+${if cfg.autoLockBeforeSuspend then ''exec swayidle -w before-sleep "swaylock -f -i $lockscreen"'' else ""}
 
 # subraum
 #bindsym $mod+Delete exec ~/run/subraum/hackbuzzer
diff --git a/modules/sway/default.nix b/modules/sway/default.nix
index 025ceb7..6b7f896 100644
--- a/modules/sway/default.nix
+++ b/modules/sway/default.nix
@@ -15,7 +15,12 @@ in
         type = types.str;
         default = "jens";
       };
+      autoLockBeforeSuspend = mkOption {
+        type = types.bool;
+        default = true;
+      };
     };
+
   };
   config = mkIf cfg.enable {
     home-manager.users."${cfg.user}" = { pkgs, ... }: {
-- 
GitLab