2023-04-06 03:29:01 +05:30
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2023-05-13 00:32:03 +05:30
|
|
|
DIR="${1:-}"
|
|
|
|
if [ -z "$DIR" ]; then
|
|
|
|
echo "Usage: $0 <path to directory containing wallpapers>"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-04-06 03:29:01 +05:30
|
|
|
|
|
|
|
random_paper() {
|
2023-05-18 20:10:15 +05:30
|
|
|
if [ -d "$DIR" ] ; then
|
2023-10-18 22:00:44 +05:30
|
|
|
find -L "${DIR}"/ -type f -regextype egrep -regex ".*\.(jpe?g|png)$" | shuf -n1 --random-source=/dev/urandom
|
2023-05-18 20:10:15 +05:30
|
|
|
elif [ -f "$DIR" ] ; then
|
|
|
|
echo "$DIR"
|
|
|
|
fi
|
2023-04-06 03:29:01 +05:30
|
|
|
}
|
|
|
|
|
2023-05-18 16:06:40 +05:30
|
|
|
swww query || swww init
|
2023-11-04 15:30:17 +05:30
|
|
|
convert "$(random_paper)" /tmp/wallpaper.jpg && swww img --transition-step 2 --transition-type random --transition-duration 1 "/tmp/wallpaper.jpg"
|
2023-04-06 03:29:01 +05:30
|
|
|
convert "$(random_paper)" /tmp/lockpaper.jpg
|
2023-05-18 16:06:40 +05:30
|
|
|
|
2024-01-04 21:51:22 +05:30
|
|
|
notify-send -r 1234 -i information -t 5000 "Wallpaper" "Wallpaper changed."
|