#!/bin/sh add_theme() { INDIR="$1" [ -z "$INDIR" ] && INDIR=$HOME/pictures/wallpapers OUTDIR=$HOME/.local/share/wallpapers [ ! -d "$INDIR" ] && exit 1 [ ! -d "$OUTDIR" ] && mkdir -p "$OUTDIR" for INFILE in $(sxiv -rot "$INDIR"); do OUTFILE="$OUTDIR"/$(basename "$INFILE") convert -verbose "$INFILE" -geometry 1920x1080^ -gravity center -crop 1920x1080+0+0 "$OUTFILE" wpg -a "$OUTFILE" done wait } set_theme() { THEME=$(sxiv -rot $HOME/.config/wpg/wallpapers) [ -z "$THEME" ] && exit 4 wpg -s "$THEME" & convert -verbose -background black -vignette 100x65000 "$THEME" $HOME/.local/share/wallpapers/lock.png & } [ "$1" = "-a" ] && add_theme "$2" set_theme wait