This commit is contained in:
Alexander Navarro 2023-05-26 20:21:59 -04:00
parent 6ef2e516ef
commit 6113256074
5 changed files with 45 additions and 11 deletions

View file

@ -2,14 +2,41 @@
set -euo pipefail
# WALLPAPER_DIR=${HOME}/Drives/Stuff/Pictures/Waifus
WALLPAPER_DIR=${HOME}/Pictures/Screenshots
SCAN_DIR=${HOME}/Drives/Stuff/Pictures/Waifus
OUPUT_DIR=${HOME}/Drives/Stuff/Pictures/Wallpapers
# SCAN_DIR=${HOME}/Pictures/Screenshots
franchises=(
Mario
Zelda
Persona
)
orientations=(
Portrait
Landscape
)
# TODO: give option to exit script while inside fzf
get_fzf() {
# run inside subshell because fzf exit with 1 when no mach has been selected
output="$(
printf "%s\n" "$@" | fzf \
--reverse \
--height '10' \
--print-query \
--cycle \
--bind \
"alt-1:pos(1)+accept,alt-2:pos(2)+accept,alt-3:pos(3)+accept,alt-4:pos(4)+accept,alt-5:pos(5)+accept,alt-6:pos(6)+accept,alt-7:pos(7)+accept,alt-8:pos(8)+accept,alt-9:pos(9)+accept,alt-0:pos(10)+accept"
)"
echo "$output"
}
readarray -td '' wallpapers < <(
fd -ap -e jpg -e jpeg -e png -e webp \
--max-depth 2 \
--print0 \
--base-directory "$WALLPAPER_DIR"
fd -ap -e jpg -e jpeg -e png -e webp \
--max-depth 2 \
--print0 \
--base-directory "$SCAN_DIR"
)
# open all images in imv
@ -18,12 +45,18 @@ pid=$!
sleep 1
for dir in "${orientations[@]}"; do
mkdir -p "$OUPUT_DIR/$dir"
done
for img in "${wallpapers[@]}"; do
orientation=$(get_fzf "${orientations[@]}")
franchise=$(get_fzf "${franchises[@]}")
echo "$img"
sleep ".2"
cp "$img" "$OUPUT_DIR/$orientation"
imv-msg "$pid" next
echo "$img $orientation $franchise"
imv-msg "$pid" next
done
imv-msg "$pid" close all