3

I'm interested in changing my lock screen background through the command line. I'm hoping to be able to do it such that, after I run a series of commands, the next time it locks that image comes up. That is, no restarting is necessary in between lock screen background changes.

Is this possible with Ubuntu 15.04?

5
  • Which desktop (and lockscreen) are you using (Unity etc)
    – Wilf
    May 23, 2015 at 19:25
  • I'm using Unity.
    – Luke
    May 23, 2015 at 20:17
  • Use this : askubuntu.com/a/64002/295286 . Works 100%, but have to repeat it if you change background in any way May 23, 2015 at 21:35
  • @LukeLaupheimer Personally I use lightdm-gtk-greeter, which is still lightdm, just different variation of it, and can set login background, and I'm on 15.04 as well. If you don't mind switching to that greeter, I can post an answer for it May 23, 2015 at 21:57
  • Yeah that's fine for me. As long as I can do it in the command line and I don't have to restart each time I do it.
    – Luke
    May 24, 2015 at 0:05

2 Answers 2

3

For me (Ubuntu 15.10 with default Unity) it is working nicely with the following command:

One time necessary:

gsettings set com.canonical.unity-greeter draw-user-backgrounds false

For change picture:

gsettings set com.canonical.unity-greeter background '/path/filename_of_picture.png'

Changed the lock screen immediately. - like Serg mentioned above. In Ubuntu 15.10 (Unity) lightdm is there by default, so just the above mentioned command needed.

Tested with:

xdg-screensaver lock

command which immediately locks the computer.

I just tried in terminal (not from background, like cron), but I am pretty sure it works that way as well.

2
  • This worked wonderfully for me on Ubuntu 16.04 Sep 22, 2016 at 17:49
  • 1
    on 18.04 I had to gsettings set org.gnome.desktop.screensaver picture-uri 'file:///path/to/file
    – VeganEye
    Jun 27, 2020 at 15:12
1

I've tried a thousand and one different approaches, and the only one that actually worked for me without issue was simply overwriting the file it is on. It'll take JPEGs and PNGs, but maybe other files as well. However, the filename, including the file extension, must be the same. Here's the path:

/usr/share/backgrounds/warty-final-ubuntu.png

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .