I've tried gconftool and gconftool-2 to change the background on my Wheezy, but nothing happens. It would be nice to be able to do this from the command line.
7 Answers
For the sake of providing an answer specific to raspbian.
The background is set via /etc/alternatives/desktop-background so the background can be changed through two different ways:
sudo update-alternatives --config desktop-backgroundand you will get a list to choose from. Those are background provided by packages.- manually overwrite the
/etc/alternatives/desktop-backgroundsymlink to the file you want to use as background.
- 174
- 1
- 4
None of the above worked for me. So here is the solution for Raspbian Stretch
pcmanfm --set-wallpaper yourfile.jpg
The file can be on any path that is available to read by the user. Here I have assumed it to be /home/pi.
- 183
- 2
- 14
I've been trying to find a solution to this for ages - with all other attempts failing - and finally came up with a solution what works!
Caveat: This is using Buster on a RasPi4, and I've not tested on the other OSs or Pis.
Steps:
- Locate your
desktop-items-*.conffile. Mine are in~/.config/pcmanfm/LXDE-pi. - Use
sedto replace the filename in the config file(s). (I have two as I'm using two monitors). - Reload
pcmanfm
The Command:
sed -i 's/\(rpd-wallpaper\/\).*/\1fjord.jpg/g' desktop-items-*.conf && pcmanfm --reconfigure
In this case, replace fjord.jpg with your desired file.
I'm planning to set this up as a cron job which runs every (n) minutes, but have not tested this yet.
- 229
- 2
- 13
This depends somewhat on which DE you are using. Raspbian by default uses LXDE, so if you search online for "LXDE change background" you will find some suggestions, such as right-clicking on the desktop.
Something which tends to work universally, in my experience, is:
display -window root /your/image/file
If the display command is not found, apt-get install imagemagick.
However, ideally you should use LXDE's mechanism (presuming LXDE really is your desktop environment), if you can find it, since this will make it easier to keep permanent.
- 60,325
- 17
- 117
- 234
Raspberry Pi with the standard X-Windows. I use:
pcmanfm -w /home/username/image.jpg
Then I rotate this in a bash script.
- 11
- 1
As goldilocks sayed, to simply change your desktop background on linux :
display -window root /your/image/file
To change your lock-screen background Manually on linux debian (here wheezy version) :
1 - Verify that symbolic link on lock-screen background exists : sudo ls -l /etc/alternatives/desktop-background ;
2 - change manually the symbolic link to link the new background : sudo unlink /etc/alternatives/desktop-background ; sudo ln -s /home/MyFirstUserHome/background-fake/a_background.jpg /etc/alternatives/desktop-background
3 - Try to lock your screen to see if the changes took effect
If this solution doesn't work, it means that an xml file probably handle different resolutions associated with their own shortcut to their image_file (on wheezy debian obviously...).
So you need to verify your resolution (Settings -> Display), and try to add your configuration in the file with your favourite editor : (Example using gedit for the example)
1 - sudo apt-get install gedit ; 2 - sudo cat /usr/share/images/desktop-base/joy.xml ;
<background>
<static>
<duration>8640000.0</duration>
<file>
(.....the configuration per resolution ...)
</file>
</static>
</background>
3 - search the configuration line corresponding to your resolution : Example if my display resolution is 1920x975 :
<size width="1920" height="975">here_is_the_path/background.svg</size>
Note : If you can't find the line corresponding to your resolution, add the line with a text-editor because the width and height values of the configuration line must correspond exactly to your display resolution setting.
4 - replace the background-path of the line or create the line if necessary :
<size width="1920" height="975">/home/Me/background/test.jpg</size>
5 - Save the file and try again to look the lock-screen background !
4 - If all of that doesn't work it seems to be a big mistake !
Hoping that helped ..
If running a recent version of Raspbian (Debian wheezy), you can simply go to Menu, select Preferences, then Appearance Settings, and under Picture select the .png file you want for your background, and it changes right away.