summaryrefslogblamecommitdiff
path: root/themer.sh
blob: c8b01a0861ea7cac75d61052e35504807a7e4b06 (plain) (tree)

























                                                                                                                
#!/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