Ubuntu – How does setting wallpapers work in Ubuntu

unitywallpaper

One of the first customizations that any new user to any operating system likes to do has to be setting his or her own wallpaper! Yes, this can be done in Ubuntu too. As long as the user keeps to the few wallpapers that come built in with Ubuntu, it should not be a problem. So the user has to play in the sandbox to avoid unnecessary headaches. For as soon as the user starts selecting his or her own pictures or one of the freely available wallpapers from the Web, things start to get complicated.

Problem #1:

desktop

  1. User stores a JPEG picture file named bird.jpg in
    /home/user/Desktop.
  2. User right clicks on the file icon and selects "set as wallpaper".
  3. The file is copied from /home/user/Desktop to
    /home/user/Pictures/Wallpapers, and the file is set as the desktop
    wallpaper.

Why does the file need to be copied? For safety? In case the original file is moved or deleted?

Problem #2:

bird

  1. User opens /home/user/Pictures/Wallpapers.
  2. User right clicks on the file icon for bird.jpg and selects "set as
    wallpaper".
  3. The file is duplicated as bird (copy).jpg in the current folder, and
    the file is set as the desktop wallpaper.
  4. User right clicks on bird.jpg again and selects "set as wallpaper"
    again.
  5. The file is duplicated as bird (another copy).jpg in the current
    folder, and the file is set as desktop wallpaper.

Why is it necessary to create dupes in order to set a certain file as the wallpaper?

Problem #3:

appearance
appearance2
wallpapers

  1. User opens /home/user/Pictures/Wallpapers and deletes all the
    files in it.
  2. User opens Appearance dialog box.
  3. User clicks on the plus button to add a picture to the "Wallpapers"
    list.
  4. User navigates to /home/user/Desktop, selects bird.jpg
    and clicks on Open button.
  5. The picture is added, but not to the "Wallpapers" list. It is added
    to the "Pictures Folder" list.
  6. User navigates to /home/user/Pictures/ and finds an empty folder
    (except for one sub-folder).
  7. User navigates to /home/user/Pictures/Wallpapers and finds an
    empty folder.

Why is the picture file added to "Pictures Folder" list and not the "Wallpapers" list?

If the file is added to "Pictures Folder" list, why is the /home/user/Pictures folder empty? If "Pictures Folder" represents a folder name, what is its search path?

Problem #4:

appearance2
appearance3

  1. User does the steps 2 to 4 from previous problem description.
  2. User closes the Appearance dialog box.
  3. User opens the Appearance dialog box.
  4. The "Pictures Folder" list has now magically turned up empty.

What I would like to do is designate one specific folder in which I will keep all the pictures I want to be able to select from and use as my desktop wallpaper.

The reason I constrain myself to one folder is because of the problems I described above. I am willing to do it this way in order to avoid dupes, because I usually change the wallpaper by finding the file I want to use. I don't go hunting for the right settings dialog box first and then the file. (I guess I am doing it wrong from the perspective of Ubuntu evangelists.) I then use the mouse click context menu to do exactly what I want, and Ubuntu does have this option, but it's poorly implemented.

So I am willing to work around this shortcoming and use the Appearance dialog box (the "right" way), and a specific folder from which I can select wallpapers using the dialog box. But even for this to work, I need to get rid of the problem number 4 where Appearance dialog box doesn't want to display the files or locations I picked out earlier for it to show me as a list.

How do you guys deal with this? Just stick to the default wallpapers???…

Best Answer

There are different forces at play. The canonical way to alter wallpapers is using org.gnome.desktop.background picture-uri schema and key. The important part is that the picture has to be a local file.

In case of problem #4, the schema is being altered directly; note that all available options in the appearance settings are from local folders.

in case of other problems you've specified, it's being done through nautilus, and nautilus has possibility of accessing network-shared drives, which means user may attempt setting background image from there. Well, remember what i said - the image must be local ? That's the reason why nautilus will copy the file.

The exact code for that is set in nautilus-view.c file

static void
action_set_as_wallpaper_callback (GtkAction    *action,
                                  NautilusView *view)
{
        GList *selection;

        /* Copy the item to Pictures/Wallpaper since it may be
           remote. Then set it as the current wallpaper. */

How to work around that ? There's really no way as it is hard-coded into nautilus. You may want to file a feature request with the developers or alter the source yourself.

Related Question