summaryrefslogblamecommitdiff
path: root/themer.sh
blob: 07d7182b0c16bdd36381feace044edbb2ed7644a (plain) (tree)
1
2
3
4
5
6
7
8
9


             


                                            


                                                  
                                                                                       
                                                                                                       
                                 
            


             
                                                   
                                 
                       
                                                                                                         

 




                                        
                                 
                            
#!/bin/sh

add_theme() {
	indir=$1
	[ -z "$indir" ] && indir=~/downloads
	outdir=~/.local/share/wallpapers
	[ ! -d "$indir" ] && exit 1
	[ ! -d "$outdir" ] && mkdir -p "$outdir"
	sxiv -rot "$indir" | while read infile; do
	outfile=$outdir/$(basename "$infile" | tr ' ' '_' | tr '[:upper:]' '[:lower:]')
		convert "$infile" -geometry '2560x1440^' -gravity center -crop 2560x1440+0+0 "$outfile"
		wpg -a "$outfile"
	done
}

set_theme() {
	theme=$(sxiv -rot ~/.config/wpg/wallpapers)
	[ -z "$theme" ] && exit 4
	wpg -s "$theme"
	#convert -verbose -background black -vignette 100x65000 "$theme" ~/pictures/wallpapers/lock.png &
}

reapply_theme() {
	wpg -s "$(wpg -c)"
}

[ "$1" = "-r" ] && reapply_theme && exit
[ "$1" = "-a" ] && add_theme "$2"
[ "$1" = "-s" ] && set_theme