Files
dotfiles/.fehbg
T
Daniele Fucini b10970bf36 Keep the wallpaper when movie restores the screen layout
.fehbg now saves its random picks to ~/.cache/wallpapers and redraws them with
--keep; screen-layout passes this through with --keep-wallpaper, used by movie.
2026-10-24 16:31:02 +02:00

14 lines
496 B
Bash
Executable File

#!/bin/bash
# Sets a random wallpaper on each monitor; with --keep, redraws the last ones picked instead.
cache=${XDG_CACHE_HOME:-$HOME/.cache}/wallpapers
if [[ $1 != --keep || ! -s $cache ]]; then
# One image per connected output, so --keep still has enough after an output was off
count=$(xrandr --query | grep -c ' connected')
shuf -n "$count" -e ~/.local/share/backgrounds/random/* > "$cache"
fi
mapfile -t walls < "$cache"
exec /usr/bin/feh --no-fehbg --bg-fill "${walls[@]}"