Skip to content

Instantly share code, notes, and snippets.

@mcpcpc
Last active June 18, 2020 12:45
Show Gist options
  • Save mcpcpc/4123dacda12c3a3d300aa421f9f7f10e to your computer and use it in GitHub Desktop.
Save mcpcpc/4123dacda12c3a3d300aa421f9f7f10e to your computer and use it in GitHub Desktop.
KISS Linux Background Update and Display
#!/bin/sh -f
#
# POSIX sh background setter
img() {
[ -d "$1" ] && {
set +f
set -f -- "$1/"*
shift "$(shuf -i "1-$#" -n 1)"
}
[ -f "${img:=$1}" ] || exit 1
printf '%s\n' "$img"
}
main() {
# mkdir -p "${cache_dir:=${XDG_CACHE_HOME:=${HOME}/.cache}/bud}"
img "$1"
display \
-page 3200x \
-sample 3200x \
-window root \
"$img" &
}
main "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment