55 lines
1.2 KiB
Bash
Executable File
55 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# vi: ts=4
|
|
|
|
# Lockscreen script that will capture a screenshot, pixelate and add an overlay (all optional).
|
|
# If no toggle is enabled, the overlay image for the final image is used instead. $overlayPath with
|
|
# a black backgrond color.
|
|
# Optional features require the `imagemagick` package.
|
|
|
|
# Constants
|
|
lockscreenDir=$(mktemp -d)
|
|
lockscreenPath=$lockscreenDir/lock.png
|
|
|
|
# Config
|
|
screenshotBin=grim
|
|
lockscreenBin=swaylock
|
|
overlayPath=~/.dotfiles/lock_overlay.png
|
|
font=Terminus
|
|
extraArguments=
|
|
|
|
# Toggles
|
|
screenshot=false
|
|
pixelate=false
|
|
overlay=false
|
|
|
|
cd $lockscreenDir
|
|
|
|
# Take screenshot
|
|
if $screenshot; then
|
|
$screenshotBin $lockscreenPath
|
|
else
|
|
cp $HOME/.wallpaper $lockscreenPath
|
|
fi
|
|
|
|
# Pixelate
|
|
if $pixelate; then
|
|
convert $lockscreenPath -scale 10% -scale 1000% $lockscreenPath
|
|
fi
|
|
|
|
# Overlay
|
|
if $overlay; then
|
|
convert "$lockscreenPath" "$overlayPath" -gravity center -composite "$lockscreenPath"
|
|
fi
|
|
|
|
if ! $screenshot && ! $pixelate && ! $overlay; then
|
|
lockscreenPath=$overlayPath
|
|
extraArguments="$extraArguments --scaling=center --color=#000001ff"
|
|
fi
|
|
|
|
# Lock screen
|
|
$lockscreenBin \
|
|
-n \
|
|
--image $lockscreenPath \
|
|
--font=$font \
|
|
$extraArguments
|