Skip to content

Instantly share code, notes, and snippets.

@Dih5
Created August 28, 2020 21:45
Show Gist options
  • Save Dih5/28fa63a0a76681bdaad0d20ee27fae47 to your computer and use it in GitHub Desktop.
Save Dih5/28fa63a0a76681bdaad0d20ee27fae47 to your computer and use it in GitHub Desktop.
Set a random wallpaper in MATE
#!/bin/bash
# path to the wallpaper directory
rep="$HOME/wallpapers"
# list of files (assumed images)
images=("${rep}/"*)
# Random position
choice=$((${RANDOM} % ${#images[@]}))
# Set the image as wallpaper (note quotes are expected)
dconf write /org/mate/desktop/background/picture-filename "'${images[${choice}]}'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment