How to make wallpaper that changes throughout the day- brightness to be precise
How to change brightness of wallpapers with time of the day, like the default wallpaper given.
What tutorials suggest is to use a picture slide-show or applications like F.lux
.
But I want to automate the brightness only of the image based on time, just like the default wallpaper given in Ubuntu.
Wherever I've written USER
, change it to your username (e.g. mine is tim
).
Create a new folder, perhaps in your pictures folder, and navigate to it:
mkdir /home/$USER/Pictures/Wallpaper
cd /home/$USER/Pictures/Wallpaper
make a new file, make it executable, and edit it:
touch bgchange.sh
chmod +x bgchange.sh
gedit bgchange.sh
Add the following to the file (where is says USER below you need to change this to your user):
#! /bin/bash
gsettings set org.gnome.desktop.background picture-uri 'file:///home/USER/Pictures/Wallpaper/'$(date +%H)'.png'
That will change the image on the hour to an image with the hour name (i.e. at 1pm (13:00) it will change the background to an image called 13.png
.
Now to create the images. Simply run this command:
for i in {0..23}; do convert -brightness-contrast $(($i*2))x0 image.png $i.png; done
You will end up with a series of images, each "2" brighter than the previous. The darkest (original) will be 0.png
, the brightest 23.png
. It will look a little like this:
You may want to rename these to change the order, but make sure there is an image for every hour (0 to 23).
Finally, the script needs to start at boot:
Run this command, and press enter (2 is selected by default):
crontab -e
and add this line:
0 * * * * /home/USER/Pictures/Wallpaper/bgchange.sh
Then press Ctrl+X, type Y
and press enter. It will start each time you boot the computer.
My pronouns are He / Him