Update swaylock-cool

- Faster blur
- Avoid double-locking on sleep
This commit is contained in:
2021-10-27 20:06:52 +02:00
parent b036544c76
commit a726a701e6
3 changed files with 13 additions and 16 deletions

View File

@ -48,13 +48,10 @@ output eDP-1 scale 1.5
exec mako exec mako
### Idle configuration ### Idle configuration
#
# Example configuration:
#
exec swayidle -w \ exec swayidle -w \
timeout 300 'swaylock-cool -f' \ timeout 300 'swaylock-cool -fFe' \
timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ 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 # 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 # your displays after another 300 seconds, and turn your screens back on when
@ -92,7 +89,7 @@ input * {
bindsym $mod+d exec $menu bindsym $mod+d exec $menu
# Lock the screen # 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. # Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod. # Resize them with right mouse button + $mod.

View File

@ -8,7 +8,7 @@
} }
window#waybar { 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); border-bottom: 3px solid rgba(55, 76, 110, 0.0);
color: #ffffff; color: #ffffff;
transition-property: background-color; transition-property: background-color;

View File

@ -1,8 +1,12 @@
#!/bin/sh #!/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 for CMD in $OPTIONAL_CMDS; do
if ! command -v "$CMD" &> /dev/null if ! command -v "$CMD" &> /dev/null
@ -19,17 +23,13 @@ BASE_IMAGE_DIR="$(mktemp -d)"
INDEX=1 INDEX=1
image_path() { 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)" grim "$(image_path 1)"
convert -scale $DOWNSCALE -scale $UPSCALE "$(image_path 1)" "$(image_path 2)" lockscreen-blur -i "$(image_path 1)" -o "$(image_path 2)" -b 40 --stamp ~/.config/sway/ferris-stamp.png
convert -composite -gravity center "$(image_path 2)" ~/.config/sway/ferris-stamp.png "$(image_path 3)"
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" rm -r "$BASE_IMAGE_DIR"