Skip to content

Instantly share code, notes, and snippets.

@T2Knock
Forked from himalay/auto-wall
Created October 10, 2023 06:45
Show Gist options
  • Save T2Knock/8cf7303c61b75a8256974251b8ecf35e to your computer and use it in GitHub Desktop.
Save T2Knock/8cf7303c61b75a8256974251b8ecf35e to your computer and use it in GitHub Desktop.
Sets random wallpaper every 30 minutes using feh(A lightweight and powerful image viewer).
#!/usr/bin/bash
img=(`find ~/pictures/wallpapers/ -name '*' -exec file {} \; | grep -o -P '^.+: \w+ image' | cut -d':' -f1`)
while true
do
feh --bg-scale "${img[$RANDOM % ${#img[@]} ]}"
sleep 30m
done
@T2Knock
Copy link
Author

T2Knock commented Oct 10, 2023

Single line using shuf

shuf -e -n1 ~/Pictures/nordic-wallpapers/wallpapers/* | xargs feh --bg-scale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment