Changing desktop background in bash [duplicate]
I wanted to make a bash script that takes a random picture from a folder and sets it as the desktop background. I figured out the algorithm (it's not hard) but I can't find a command that would change the background picture if you give it the path to the picture.
I found gconftool
for bash 2.~ and gsettings
for bash 3.~, but i have GNU bash, version 4.3.42(1)-release on Ubuntu 16.04 LTS and these don't work.
Assuming you're using standard Ubuntu 16.04 with Unity, you can use the following command to set the wallpaper:
gsettings set org.gnome.desktop.background picture-uri "file:///home/username/path/to/image.jpg"
You should also look at Variety wallpaper changer - it does the same thing as what you want to do with a shell script, with a lot of features and options.