mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 23:49:56 +00:00
Rewrite i3lock lockscreen with wallpaper, cover resize and caching
- Replace screenshot+blur with static wallpaper (void-minimalist.png) - Resize to display resolution with cover mode (resize^ + extent) - Cache resized image in ~/.cache/i3lock/ to avoid re-encoding - Invalidate cache when wallpaper or resolution changes - Add xdotool to void_packages_base for display geometry detection
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
img=/tmp/lockscreen.png
|
||||
wallpaper="$HOME/.config/i3/wallpapers/void-minimalist.png"
|
||||
cached="$HOME/.cache/i3lock/wallpaper.png"
|
||||
dims_cache="$HOME/.cache/i3lock/dims.txt"
|
||||
dims=$(xdotool getdisplaygeometry | tr ' ' 'x')
|
||||
|
||||
# screenshot
|
||||
scrot "$img"
|
||||
if [ ! -f "$cached" ] || \
|
||||
[ "$(stat -c %Y "$wallpaper")" -gt "$(stat -c %Y "$cached")" ] || \
|
||||
[ "$dims" != "$(cat "$dims_cache" 2>/dev/null)" ]; then
|
||||
mkdir -p "$HOME/.cache/i3lock"
|
||||
convert "$wallpaper" -resize "$dims^" -extent "$dims" PNG:- > "$cached"
|
||||
echo -n "$dims" > "$dims_cache"
|
||||
fi
|
||||
|
||||
# blur
|
||||
convert "$img" -blur 0x8 "$img"
|
||||
|
||||
# lock
|
||||
i3lock \
|
||||
--image "$img" \
|
||||
--image "$cached" \
|
||||
--clock \
|
||||
--indicator \
|
||||
--radius 100 \
|
||||
|
||||
Reference in New Issue
Block a user