From a726a701e64a6daac392c964d3a35e22e1e7106f Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Wed, 27 Oct 2021 20:06:52 +0200 Subject: [PATCH] Update swaylock-cool - Faster blur - Avoid double-locking on sleep --- tree/.config/sway/config | 9 +++------ tree/.config/waybar/style.css | 2 +- tree/.local/bin/swaylock-cool | 18 +++++++++--------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/tree/.config/sway/config b/tree/.config/sway/config index aa7ddc5..e5b2dd5 100644 --- a/tree/.config/sway/config +++ b/tree/.config/sway/config @@ -48,13 +48,10 @@ output eDP-1 scale 1.5 exec mako ### Idle configuration -# -# Example configuration: -# exec swayidle -w \ - timeout 300 'swaylock-cool -f' \ + timeout 300 'swaylock-cool -fFe' \ timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ - before-sleep 'swaylock-cool -f' + before-sleep 'swaylock-cool -fFe' # This will lock your screen after 300 seconds of inactivity, then turn off # your displays after another 300 seconds, and turn your screens back on when @@ -92,7 +89,7 @@ input * { bindsym $mod+d exec $menu # Lock the screen - bindsym $mod+Shift+Plus exec "swaylock-cool -f" + bindsym $mod+Shift+Plus exec "swaylock-cool -fFe" # Drag floating windows by holding down $mod and left mouse button. # Resize them with right mouse button + $mod. diff --git a/tree/.config/waybar/style.css b/tree/.config/waybar/style.css index 7eb1f4c..86d97ab 100644 --- a/tree/.config/waybar/style.css +++ b/tree/.config/waybar/style.css @@ -8,7 +8,7 @@ } window#waybar { - background-color: rgba(91, 63, 99, 0.7); + background-color: rgba(48, 47, 59, 0.7); border-bottom: 3px solid rgba(55, 76, 110, 0.0); color: #ffffff; transition-property: background-color; diff --git a/tree/.local/bin/swaylock-cool b/tree/.local/bin/swaylock-cool index 6b5a515..ce55507 100755 --- a/tree/.local/bin/swaylock-cool +++ b/tree/.local/bin/swaylock-cool @@ -1,8 +1,12 @@ #!/bin/sh -BLUR_FACTOR=64; +# check if swaylock is running +if ps -e | grep " swaylock$"; then + echo "swaylock is already running!" + exit 1 +fi -OPTIONAL_CMDS=("convert" "python3" "grim") +OPTIONAL_CMDS=("convert" "python3" "grim", "lockscreen-blur") for CMD in $OPTIONAL_CMDS; do if ! command -v "$CMD" &> /dev/null @@ -19,17 +23,13 @@ BASE_IMAGE_DIR="$(mktemp -d)" INDEX=1 image_path() { - echo "$BASE_IMAGE_DIR/$1.jpg" + echo "$BASE_IMAGE_DIR/$1.png" } -UPSCALE="$(python3 -c "print(100*$BLUR_FACTOR, end='')")%" -DOWNSCALE="$(python3 -c "print(100/$BLUR_FACTOR, end='')")%" - grim "$(image_path 1)" -convert -scale $DOWNSCALE -scale $UPSCALE "$(image_path 1)" "$(image_path 2)" -convert -composite -gravity center "$(image_path 2)" ~/.config/sway/ferris-stamp.png "$(image_path 3)" +lockscreen-blur -i "$(image_path 1)" -o "$(image_path 2)" -b 40 --stamp ~/.config/sway/ferris-stamp.png -swaylock --config ~/.config/sway/swaylock.config --image "$(image_path 3)" +swaylock --config ~/.config/sway/swaylock.config --image "$(image_path 2)" $@ rm -r "$BASE_IMAGE_DIR"