From 431d1659a419ae03e05260ace9a3c10844162b43 Mon Sep 17 00:00:00 2001 From: Asmir A Date: Sat, 24 May 2025 11:02:50 +0200 Subject: [PATCH] home/swaylock: update locker script --- home/home.nix | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/home/home.nix b/home/home.nix index 5a29d13..5ad057f 100644 --- a/home/home.nix +++ b/home/home.nix @@ -253,18 +253,26 @@ in swayidle = let locker = pkgs.writeShellScriptBin "swaylock_fancy" '' - TMP_FILE=$(${pkgs.coreutils}/bin/mktemp /tmp/.swaylock_ss_XXXXXX.jpg) - ${lib.getExe pkgs.grim} -t ppm - | ${pkgs.imagemagick}/bin/convert - -blur 0x12 "$TMP_FILE" - ${lib.getExe pkgs.swaylock} -f -i "$TMP_FILE" - ${pkgs.coreutils}/bin/shred "$TMP_FILE" - ${pkgs.coreutils}/bin/rm "$TMP_FILE" + ALL_IMGS="" + LOCK_ARGS="" + for OUTPUT in $(${pkgs.sway}/bin/swaymsg -t get_outputs | ${lib.getExe pkgs.jq} -r '.[].name') + do + TMP_FILE=$(${pkgs.coreutils}/bin/mktemp /tmp/.swaylock_ss_XXXXXX.jpg) + ${lib.getExe pkgs.grim} -t ppm -o $OUTPUT - | \ + ${lib.getExe pkgs.ffmpeg} -y -loglevel 0 -i - -vframes 1 -vf "boxblur=10" "$TMP_FILE" + LOCK_ARGS="$LOCK_ARGS --image $OUTPUT:$TMP_FILE" + ALL_IMGS="$ALL_IMGS $TMP_FILE" + done + ${lib.getExe pkgs.swaylock} -f $LOCK_ARGS + ${pkgs.coreutils}/bin/shred $ALL_IMGS + ${pkgs.coreutils}/bin/rm $ALL_IMGS ''; - /* + in + /* refresh_i3status = pkgs.writeShellScriptBin "refresh_i3status" '' ${pkgs.coreutils}/bin/sleep 1 && ${pkgs.procps}/bin/pkill -USR1 i3status-rs ''; - */ - in + */ { enable = true; events = [ @@ -276,12 +284,12 @@ in event = "lock"; command = "${locker}/bin/swaylock_fancy"; } - /* - { - event = "after-resume"; - command = "${refresh_i3status}/bin/refresh_i3status"; - } - */ + /* + { + event = "after-resume"; + command = "${refresh_i3status}/bin/refresh_i3status"; + } + */ ]; timeouts = [ {