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
|
|
|
if [ ! -d "$DIR" ]; then
|
|
|
|
echo "$DIR: not a directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
random_paper() {
|
|
|
|
find -L "${DIR}"/ -type f -regextype egrep -regex ".*\.(jpe?g|png)$" | shuf -n1
|
|
|
|
}
|
|
|
|
|
2023-05-16 00:19:04 +05:30
|
|
|
convert "$(random_paper)" /tmp/wallpaper.jpg && (pkill swaybg; swaybg -i "/tmp/wallpaper.jpg" -m fill &)
|
2023-04-06 03:29:01 +05:30
|
|
|
convert "$(random_paper)" /tmp/lockpaper.jpg
|