How to change the wallpaper randomly in Ubuntu and derivatives

On previous occasions we have talked about how to change wallpaper randomlyIn this case we will do it without having to download the images ourselves, but our script will automatically download wallpaper from wallhaven and it will change it from time to time, as we configure it.

change wallpaper randomly

change wallpaper randomly

To achieve all this we must carry out a series of steps, which we will describe below:

Install Python-pip

We execute the following command from our terminal:

sudo apt install python-pip

Install required Dependencies

We execute the following commands from our terminal:

pip install BeautifulSoup4

pip install --upgrade pip

Installing the Necessary Scripts

We clone the repository with the scripts that will allow us to download random wallpaper and choose it as our wallpaper. To do this we execute the following commands:

git clone https://github.com/kirillsulim/ubuntu-wallpaper-switcher.git

cd ubuntu-wallpaper-switcher/

We execute the .sh in charge of starting the process in python that is responsible for carrying out the entire process:

./set-wallpaper.sh

Give execution permissions and schedule the time with which the wallpaper will change

We go to the desktop where the script was downloaded

cd ubuntu-wallpaper-switcher/

We give execution permissions to the .sh

chmod a+x set-wallpaper.sh

Then we schedule a crontab to run as desired, for example:

crontab -e

And we parameterize it in my case so that it changes every 45 minutes:

*/45 * * * * /home/lagarto/ubuntuswitcher/set-wallpaper.sh 2>&1 >> /var/log/tare$

You can learn to make the configuration you want for your crontab from this excellent article Cron & crontab, explained

The images of each of the wallpapers are housed in the script directory.ubuntu-switcher

I hope you like this method and do not hesitate to leave us your comments.


3 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   kdexneo said

    Sakludos,

    You can use this application that does the same. Variety is an open-source wallpaper changer for Linux

    1.    HO2gi said

      Please «sakludos» and «Puedem» “is an” put “is a”, correct the text thanks.
      Variety didn't take it into account but now it does, thanks for the tip.

  2.   Louise. said

    Hi I think it would look better if you put 2 bars in cinnamon then remove the bottom one and put the dock d plank. you would have plenty of space