about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-12-05 12:10:33 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-12-05 12:10:33 +0100
commitbb668c1bdfb2937e2ca987426aac6cfe1b544fc9 (patch)
treed79cf81c85816f0f93992265a9f460ce5ac3bcb8 /modules
parent48c708af222cd4120d81565200e046dc3414b3b1 (diff)
downloaddots-bb668c1bdfb2937e2ca987426aac6cfe1b544fc9.tar.gz
dots-bb668c1bdfb2937e2ca987426aac6cfe1b544fc9.zip
Add slock mediakeys and xautolock
Diffstat (limited to 'modules')
-rw-r--r--modules/slock.nix14
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/slock.nix b/modules/slock.nix
index df6f23c..85c78de 100644
--- a/modules/slock.nix
+++ b/modules/slock.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ config, pkgs, ... }:
 
 let
   slock = pkgs.slock.overrideAttrs(oldAttrs: {
@@ -11,9 +11,19 @@ let
       # ../platforms/linux/xorg/slock/slock-pam_auth-20190207-35633d4.diff
       ../platforms/linux/xorg/slock/slock-capscolor-20170106-2d2a21a.diff
       ../platforms/linux/xorg/slock/slock-dpms-1.4.diff
+      ../platforms/linux/xorg/slock/slock-mediakeys.diff
     ];
   });
 in {
   environment.systemPackages = [ slock ];
-  security.wrappers.slock.source = "${slock}/bin/slock";
+  security.wrappers.slock.source = "${slock.out}/bin/slock";
+  services.xserver.xautolock = {
+    enable = true;
+    locker = "${config.security.wrapperDir}/slock";
+    enableNotifier = true;
+    notifier = "${pkgs.libnotify}/bin/notify-send \"Locking in 10 seconds\"";
+    killer = "/run/current-system/systemd/bin/systemctl suspend-then-hibernate";
+    killtime = 30;
+    extraOptions = [ "-detectsleep" ];
+  };
 }