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:
Fabio Scotto di Santolo
2026-04-17 09:47:44 +02:00
parent 3dd8b96962
commit 58aca45ac0
5 changed files with 14 additions and 9 deletions

View File

@@ -9,7 +9,7 @@ font pango:Liberation Mono 10
exec --no-startup-id dex --autostart --environment i3
exec --no-startup-id gnome-keyring-daemon --start --components=secrets
exec_always --no-startup-id setxkbmap -layout us -variant intl
exec_always --no-startup-id feh --bg-fill ~/.config/i3/wallpapers/dont_like_wallpapers.jpg
exec_always --no-startup-id feh --bg-fill ~/.config/i3/wallpapers/void-minimalist2.png
exec_always --no-startup-id ~/.config/i3/scripts/setup-gtk-theme.sh
exec --no-startup-id /usr/libexec/xdg-desktop-portal

View File

@@ -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 \

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB