Skip to content

Instantly share code, notes, and snippets.

@lbehm
Created April 18, 2023 22:11
Show Gist options
  • Save lbehm/ff168f05038340a9d2b768ea4aa994c8 to your computer and use it in GitHub Desktop.
Save lbehm/ff168f05038340a9d2b768ea4aa994c8 to your computer and use it in GitHub Desktop.
Lock screen utility for sway desktop environment. The lock screen uses a blurred screenshot.
#!/bin/env bash
IMAGE=$(mktemp -t swaylock-$USERNAME-XXXXX.png)
trap "rm -f ${IMAGE}" EXIT
# grim creates a screenshot of eDP-1. You may have to adjust your output specifier.
# convert (ImageMagick / GraphicsMagick) applies glur filter. Be creative!
grim -o eDP-1 - | \
convert - \
-blur 0x20 \
-fill black -colorize 30% \
$IMAGE
# swaylock enables lock screen with customized background. The hex color values control the unlock UI.
swaylock -e -c 111111 --inside-color 11111100 --line-color 080808AA -i :$IMAGE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment