-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-catppuccin.sh
More file actions
executable file
·65 lines (54 loc) · 1.45 KB
/
Copy pathfix-catppuccin.sh
File metadata and controls
executable file
·65 lines (54 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
set -e
DIR="$HOME/Pictures/wallpapers/catppuccin-mocha"
BATCH_SIZE=5
command -v gowall >/dev/null || { echo "gowall not found in PATH" >&2; exit 1; }
[[ -d "$DIR" ]] || { echo "no such dir: $DIR" >&2; exit 1; }
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
IN="$WORK/in"
OUT="$WORK/out"
mkdir -p "$IN" "$OUT"
IMAGES=()
while IFS= read -r -d '' img; do
IMAGES+=("$img")
done < <(find "$DIR" -maxdepth 1 -name '*.webp' -print0 | sort -z)
total=${#IMAGES[@]}
echo "=== Converting ALL catppuccin-mocha images with gowall ==="
echo "Processing in batches of $BATCH_SIZE to avoid high RAM usage"
echo "Total: $total images"
echo ""
count=0
process_batch() {
local n=$1
count=$((count + n))
echo "[$count/$total] Processing batch of $n images..."
gowall convert --dir "$IN" --theme catppuccin --output "$OUT" --format webp --yes
local out base src
for out in "$OUT"/*.webp; do
[ -f "$out" ] || continue
base=$(basename "$out")
src="$DIR/$base"
if cmp -s "$out" "$src"; then
echo " Unchanged: $base"
else
cp "$out" "$src"
echo " Done: $base"
fi
done
rm -f "$IN"/* "$OUT"/*
}
i=0
for img in "${IMAGES[@]}"; do
cp "$img" "$IN/"
i=$((i + 1))
if [ "$i" -ge "$BATCH_SIZE" ]; then
process_batch "$i"
i=0
fi
done
if [ "$i" -gt 0 ]; then
process_batch "$i"
fi
echo ""
echo "All done! $count images processed."