4

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.

6

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-background and you will get a list to choose from. Those are background provided by packages.
  • manually overwrite the /etc/alternatives/desktop-background symlink to the file you want to use as background.
  • Hello and welcome to RaspberryPi.StackExchange! – Ghanima Dec 18 '14 at 7:53
  • works, but needs you to logout and login back in again to see the change – Mike Redrobe Apr 6 '15 at 9:51
  • 2
    On my Raspbian, /etc/alternatives/desktop-background appears to be a binary file. The per user desktop wallpaper is in the home directory's .config/pcmanfm/LXDE-pi/desktop-items-0.config – Old Geezer May 14 '15 at 5:43
1

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.

  • I can't right click, I don't have a mouse on this Pi. – Phillip Moxley Jul 24 '14 at 14:25
  • The display command didn't work for me on Raspbian Jessie – Thomas Weller Aug 29 '16 at 21:02
0

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 ..

-3

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.

  • 1
    The original question asked specifically for a way to do it through the command line, and I wouldn't consider Wheezy to be recent. – Jacobm001 Mar 28 '16 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.