Refactor change-wall and wall-selector scripts

This commit is contained in:
retrilzzy committed 2025-11-29 22:56:33 +05:00
1 parent 4f50fbf423
commit 914b746d1c
2 files changed
+12 -7

No files matched your search

+4 -4
View File
@@ -45,11 +45,11 @@ fi
echo "Selected image: $selected_image"
# Get a random transition position
px=$(printf "%.2f" "$(awk -v r=$RANDOM 'BEGIN{s=r/32767} END{print s}')")
py=$(printf "%.2f" "$(awk -v r=$RANDOM 'BEGIN{s=r/32767} END{print s}')")
transition_pos="$px,$py"
rand() { printf "0.%02d\n" $((RANDOM % 100)); }
echo "Transition position: $transition_pos"
px=$(rand)
py=$(rand)
transition_pos="$px,$py"
# Set the selected image
swww img -t grow \
+8 -3
View File
@@ -15,6 +15,7 @@ if [[ ! -d "$DIR" ]]; then
exit 1
fi
# Select a wallpaper
SELECTED=$(
find "$DIR" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) |
sort |
@@ -22,14 +23,14 @@ SELECTED=$(
)
[[ -z "$SELECTED" ]] && exit 0
rand() {
printf "%.2f" "$(awk -v r=$((RANDOM % 101)) 'BEGIN {print r/100}')"
}
# Get a random transition position
rand() { printf "0.%02d\n" $((RANDOM % 100)); }
px=$(rand)
py=$(rand)
transition_pos="$px,$py"
# Set the selected image
swww img "$SELECTED" \
-t grow \
--transition-pos "$transition_pos" \
@@ -37,7 +38,11 @@ swww img "$SELECTED" \
--transition-step 255 \
--transition-fps 60
# Generate a color palette
matugen image "$SELECTED"
# Set the lock background
mkdir -p "$CACHE_DIR"
cp "$SELECTED" "$LOCK_BG_PATH"
echo "Lock background saved to: $LOCK_BG_PATH"