1

I've been using elementary os for the last half a year and now I have installed the latest Ubuntu on my system. On elementary os, I was using this command to change the desktop background:

gsettings set org.gnome.desktop.background picture-uri file:///path_to_image

However, this command does not seem to do anything in Ubuntu. I can change the background by choosing a different image in the Appearance menu but I need to change the background from a script and hence the need for a working command.

When running the above command in a terminal no error is produced. If I run the gsetting get command, it returns the background image it always had, as if nothing happened. It totally ignores my set command. The images I tried this command on are the same images in the /usr/share/backgrounds images that are provided by default. Also, I changed the permissions of the entire background folder (and its contents) to be readable and writable to everyone to no avail.

I tried logging out and back in to see if it produces any changes to the background but nothing happens and even if it did, I wouldn't like to re-login every time the background changes...

Doing an online search yielded no results.

Thank you for your time!

8
  • 1
    for me the above command is working fine. – g_p Oct 3 '14 at 11:06
  • So the command should work but for some reason it doesn't. At least not for me. Disappointing given that this is yet a fresh install and already buggy. Any ideas on how to get the command to work? – user1841330 Oct 3 '14 at 11:14
  • @user1841330 install dconf-tools, then use the dconf-editor GUI to manually set the wallpaper using that key and see if it works. If it does, then it probably is a bug and you could file a bug report. If it's not, probably something is preventing gsettings from writing that setting. – muru Oct 3 '14 at 11:22
  • ALso test if ~/.config/dconf/ is writable and owned by you. If it is not writable gsettings oddly doesn't produce an error. – muru Oct 3 '14 at 11:27
  • I already tried that and yes, the wallpaper can be set using the GUI of dconf-editor. Apart from filing a bug report and presumably doing a re-install of Ubuntu, isn't there anything to be done so as to regain functionality of this command? – user1841330 Oct 3 '14 at 11:28
4

gsettings apparently exits successfully if it could not write the setting:

$ chmod a-w .config/dconf/ -R
$ gsettings set org.gnome.desktop.background picture-uri file:///usr/share/backgrounds/Forever_by_Shady_S.jpg
$ echo $?
0

Either that is stunningly bad design, or a bug. Ensure that the ~/.config/dconf folder and everything in it is writable and owned by you:

sudo chown $USER:$USER ~/.config/dconf -R
chmod u+w ~/.config/dconf -R
1
  • Thank you! Whether or not it is by design, changing the file permissions did the trick. – user1841330 Oct 3 '14 at 14:27

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.