summaryrefslogtreecommitdiff
path: root/themer.sh
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2020-05-15 07:55:58 -0400
committerAdam T. Carpenter <atc@53hor.net>2020-05-15 07:55:58 -0400
commit2930e933305e653f2f26deacd459dd100f257168 (patch)
treeadb4f9afd05f66100fd93458e3125a075ebcd635 /themer.sh
parent680a167d6f72853eeab01970426028fc474c6005 (diff)
downloadscripts-2930e933305e653f2f26deacd459dd100f257168.tar.xz
scripts-2930e933305e653f2f26deacd459dd100f257168.zip
updated i3blocks, fixed themer, added 6cord, combined docked and undocked into toggle-docked
Diffstat (limited to 'themer.sh')
-rwxr-xr-xthemer.sh34
1 files changed, 19 insertions, 15 deletions
diff --git a/themer.sh b/themer.sh
index c8b01a0..b36c444 100755
--- a/themer.sh
+++ b/themer.sh
@@ -1,26 +1,30 @@
#!/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"
+ indir="$1"
+ [ -z "$indir" ] && indir=$HOME/downloads
+ outdir=$HOME/.local/share/wallpapers
+ [ ! -d "$indir" ] && exit 1
+ [ ! -d "$outdir" ] && mkdir -p "$outdir"
+ sxiv -rot "$indir" | while read infile; do
+ outfile="$outdir"/$(basename "$infile")
+ convert "$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 &
+ 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 &
}
+reapply_theme() {
+ wpg -s "$(wpg -c)"
+}
+
+[ "$1" = "-r" ] && reapply_theme && exit
[ "$1" = "-a" ] && add_theme "$2"
-set_theme
+[ "$1" = "-s" ] && set_theme
wait