4

I'm connected through SSH. In other words, I have no mouse nor keyboard connected to the unit. How do I change the wallpaper from the terminal?

Paolo Vacirca
  • 243
  • 2
  • 3
  • 7

2 Answers2

8

You can set the Raspberry Pi desktop background with this command under Pixel (lightdm) Desktop Manager:

pcmanfm --set-wallpaper="/your/background/file"
Darth Vader
  • 4,206
  • 24
  • 45
  • 69
  • for some reason this has serious trouble running with su... I can ssh to pi and run it, but I can't ssh to another user, sudo su pi and then run it. pcmanfm somehow remembers the original user and fails to detect it's already running. env DISPLAY=:0.0 pcmanfm -w '/home/pi/Pictures/wallpaper.jpg' – Ray Foss Oct 18 '19 at 19:40
  • My workaround is to set the wallpaper to a file, replace that file with my wallpaper using the same name, then sudo killall -9 pcmanfm. Something in the pi makes it restart when it crashes... conveniently. Voila, your wallpaper has been updated remotely... or with crontab – Ray Foss Oct 18 '19 at 21:23
1

From http://lxlinux.com (section 5 on the page):

 In a traditional set-up wallpaper can be changed by terminal launching a wallpaper GUI: 

   pcmanfm --desktop-pref,

or by directly editing the .conf files in ~/.config/pcmanfm/LXDE/. The default wallpaper folders depend upon the distribution and are generally /usr/share/backgrounds or /usr/share/lxde/wallpapers.

Sounds like you need to look at the .conf files in the ~/.config/pcmanfm/LXDE/ folder.

Phil B.
  • 5,043
  • 15
  • 30
  • Thank you. There are backgrounds in those folders indeed, but none of them is the one I see. So now I'm confused about where my wallpaper might be located. – Paolo Vacirca Apr 24 '15 at 21:41
  • Have you checked the .conf files for references to wallpaper settings? the other folders are just the location of default wallpapers available on the system. I don't have my rPi available to check, but on Lubuntu (also using LXDE) I can find the background setting in ~/.config/lxpanel/Lubuntu/panels/panel under the "Global {..}" section (it's called "Backgroundfile"). – Phil B. Apr 25 '15 at 01:14
  • backgroundfile doesn't seem to be the right thing. Points to a totally different file but not what I've set as beackground – Thomas Weller Aug 29 '16 at 20:21