This is a Bash script you can put in your Linux Mint MATE startup list to automatically change your wallpaper randomly from the images in the specified directory at the specified interval.
- Copy these contents into a text editor:
#!/bin/bash # This script randomly sets the wallpaper from files in the specified directory. # Note: Files may have spaces in their names. # The following line sets up an infinite loop that will run continuously: while true; do # The following line specifies a directory that contains images for use as wallpaper. Edit the line, replacing /PATH with the full path to the directory you wish to use: LOCATION="/PATH"; # The following line looks in the specified directory to find all files that end in .gif or .jpg or .jpeg or .png (case insensitive) and then shuffles them and randomly chooses one of them and saves its full path as the result: RESULT=$(find "$LOCATION" -iregex ".*\.\(gif\|jpg\|jpeg\|png\)" -type f | shuf -n1); # The following line sets the wallpaper using the chosen file: gsettings set org.mate.background picture-filename "$RESULT"; # The following line waits the specified number of seconds after changing the wallpaper. Edit the line, choosing the length of time you'd like the wallpaper to remain in place before being changed. 300 = 5 minutes, 600 = 10 minutes, 900 = 15 minutes, etc.: sleep 300 #The following line is the end of the infinite loop: done
- Edit the path to point to your directory full of images.
- Edit the sleep line to use the number of seconds you’d like the image to display before being changed.
- Save the file as WallpaperChanger.bash (or whatever name you would like the file to have) in the directory you keep scripts in (creating one if you like).
- Open a file manager in the directory you just put the file into.
- Right-click the file.
- Choose Properties from the context menu.
- Left-click the Permissions tab.
- Left-click inside the box next to “Allow executing file as program”.
- Left-click the close button.
- Close the file manager.
- Open the System menu.
- Choose the Preferences sub-menu.
- Choose Startup Applications.
- Left-click the Add button.
- Type the name you’d like the wallpaper changer to have in this list so you will recognize it if you come back here another time (example: Wallpaper Changer).
- Left-click the Browse… button.
- Browse to the script file you saved above.
- Left-click the Open button.
- Type a comment describing what the script does if you like (this is optional).
- Left-click the Add button. You should now see the script you just added in the list of startup applications.
- Left-click the Close button.
Now when you boot your computer the script will run, immediately choosing a random wallpaper for you, and randomly changing it to a new one at the interval you specified until you end the process or shut down the computer.
Obligatory Happy Ending
And they all lived happily ever after. The end.