From 08b97f204f29bd1c48b62ce20638b4e26f1d2a2e Mon Sep 17 00:00:00 2001 From: Asmir A Date: Mon, 13 Nov 2023 16:50:38 +0100 Subject: [PATCH] home/swayidle: switch swaylock for swaylock_fancy script --- home/home.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/home/home.nix b/home/home.nix index a7e6c3c..8105ebf 100644 --- a/home/home.nix +++ b/home/home.nix @@ -208,26 +208,33 @@ with lib; { pinentryFlavor = "curses"; }; - swayidle = { + swayidle = let + locker = pkgs.writeShellScriptBin "swaylock_fancy" '' + TMP_FILE=$(${pkgs.coreutils}/bin/mktemp /tmp/.swaylock_ss_XXXXXX.jpg) + ${pkgs.grim}/bin/grim -t ppm - | ${pkgs.imagemagick}/bin/convert - -blur 0x12 "$TMP_FILE" + ${pkgs.swaylock}/bin/swaylock -f -i "$TMP_FILE" + ${pkgs.coreutils}/bin/rm "$TMP_FILE" + ''; + in { enable = true; events = [ { event = "before-sleep"; - command = "${pkgs.swaylock}/bin/swaylock"; + command = "${locker}/bin/swaylock_fancy"; } { event = "lock"; - command = "${pkgs.swaylock}/bin/swaylock"; + command = "${locker}/bin/swaylock_fancy"; } { event = "after-resume"; - command = "${procps.pkill}/bin/pkill -USR1 i3status-rs"; + command = "${pkgs.procps}/bin/pkill -USR1 i3status-rs"; } ]; timeouts = [ { timeout = 15 * 60; - command = "${pkgs.swaylock}/bin/swaylock"; + command = "${locker}/bin/swaylock_fancy"; } ]; };