Commit 78aee1968fa3

Vincent Demeester <vincent@sbr.pm>
2019-03-26 16:34:29
modules: migrate screen saver to desktop…
… and enhance screensaver with a cool dim :) Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 232a32a
Changed files (2)
modules
modules/profiles/desktop.nix
@@ -3,6 +3,15 @@
 with lib;
 let
   cfg = config.profiles.desktop;
+  dim-screen = pkgs.writeScript "dim-sreen.sh" ''
+#!${pkgs.stdenv.shell}
+export PATH=${lib.getBin pkgs.xlibs.xbacklight}/bin:$PATH
+trap "exit 0" INT TERM
+trap "kill \$(jobs -p); xbacklight -steps 1 -set $(xbacklight -get);" EXIT
+xbacklight -time 5000 -steps 400 -set 0 &
+sleep 2147483647 &
+wait
+  '';
 in
 {
   options = {
@@ -12,6 +21,11 @@ in
         description = "Enable desktop profile";
         type = types.bool;
       };
+      lockCmd = mkOption {
+        default = "-n ${dim-screen} -- ${pkgs.slim}/bin/slimlock";
+        description = "Lock command to use";
+        type = types.str;
+      };
       xsession = {
         enable = mkOption {
           default = true;
@@ -62,6 +76,11 @@ in
         longitude = "7.5";
         tray = true;
       };
+      screen-locker = {
+        enable = true;
+        lockCmd = cfg.lockCmd;
+        inactiveInterval = 15;
+      };
     };
     home.file.".XCompose".source = ./assets/xorg/XCompose;
     home.file.".Xmodmap".source = ./assets/xorg/Xmodmap;
modules/profiles/i3.nix
@@ -13,11 +13,6 @@ in
         description = "Enable i3 profile";
         type = types.bool;
       };
-      lockCmd = mkOption {
-        default = "slimlock"; # "i3lock-color --clock --color=606060"
-        description = "Lock command to use";
-        type = types.str;
-      };
     };
   };
   config = mkIf cfg.enable {
@@ -55,11 +50,6 @@ in
       };
       udiskie.enable = true;
       network-manager-applet.enable = true;
-      screen-locker = {
-        enable = true;
-        lockCmd = cfg.lockCmd;
-        inactiveInterval = 15;
-      };
       random-background = {
         enable = true;
         imageDirectory = "${config.home.homeDirectory}/desktop/pictures/walls";