Pre-setting the current login and desktop background/wallpaper

Asked by Paul

Hello!

I am trying to set up a custom image using ubuntu 16.04.

My question is how to have the background wallpaper to be preset with the image installation. Is it possible to have a specific background appear during installation and afterwards preset on the system itself?

I was able to add the specific wallpaper file to the backgrounds folder and also edit the XML files in gnome-background-properties so far. I can change manually change the wallpaper after so I know that works at least.

Question information

Language:
English Edit question
Status:
Solved
For:
Cubic Edit question
Assignee:
No assignee Edit question
Solved by:
PJSingh5000
Solved:
Last query:
Last reply:
Revision history for this message
PJSingh5000 (pjsingh5000) said :
#1

OPTION 1
==========================
The default Gnome backgrounds are set in two files.
However these settings are overridden by a Ubuntu specific file.

DESKTOP BACKGROUND
----------------------------------------------
In the file
    /usr/share/glib-2.0/schemas/org.gnome.desktop.background.gschema.xml
Set the <default> value for
    <key name="picture-uri" type="s">
To the URI of the desktop background you want to use.

Use the correct format. For example
    <default>'file:///usr/share/backgrounds/ubuntu/my_pic.jpg'</default>

LOCK SCREEN BACKGROUND
----------------------------------------------
In the file
    /usr/share/glib-2.0/schemas/org.gnome.desktop.screensaver.gschema.xml
Set the <default> value for
    <key name="picture-uri" type="s">
To the URI of the screensave / lockscreen background you want to use.

Use the correct format. For example
    <default>'file:///usr/share/backgrounds/ubuntu/my_pic.jpg'</default>

DRAWBACKS & WORK AROUNDS
==========================
(1)
The changes above are actually OVER-RIDDEN by the following values in

    /usr/share/glib-2.0/schemas/10_ubuntu-settings.gschema.override

Here are the two values in this file

    [org.gnome.desktop.background]
    picture-uri = 'file:///usr/share/backgrounds/warty-final-ubuntu.png'

    [org.gnome.desktop.screensaver]
    picture-uri = 'file:///usr/share/backgrounds/warty-final-ubuntu.png'

If you delete /usr/share/glib-2.0/schemas/10_ubuntu-settings.gschema.override, then the default Gnome settings from org.gnome.desktop.background.gschema.xml and org.gnome.desktop.screensaver.gschema.xml will be used.

Otherwise, you can set your values directly in /usr/share/glib-2.0/schemas/10_ubuntu-settings.gschema.override.
(It's also easier than editing XML files).

(2)
EVERY TIME the package gsettings-desktop-schemas is updated your changes will be overwritten.

(3)
See OPTION 2 below for a better, easier way to do this and avoid these drawbacks.

Revision history for this message
Best PJSingh5000 (pjsingh5000) said :
#2

OPTION 2
==========================

This is the better option, so use this.

CUSTOM SCHEMA OVERRIDE FILE
----------------------------------------------

(1)
Create a file called /usr/share/glib-2.0/schemas/90_Custom.gschema.override

Notice that the name of this file is prefixed with an integer, and this integer is LARGER than the prefixes of ALL other files in /usr/share/glib-2.0/schemas/.

The higher the integer prefix, the higher priority the override file receives.

(2)
Inside this file, add your wallpapers. For example

    [org.gnome.desktop.background]
    picture-uri = 'file:///usr/share/backgrounds/my_pic.png'

    [org.gnome.desktop.screensaver]
    picture-uri = 'file:///usr/share/backgrounds/my_pic.png'

(3)
Compile all the schemas using the following command

    glib-compile-schemas /usr/share/glib-2.0/schemas

NOTES
----------------------------------------------

(1)
Even if you edit the XMLs or delete schema files, you aleays need to compile the schema (as shown in step 3). I neglected to mention this in OPTION 1, so you use that technique, remember to execute `glib-compile-schemas /usr/share/glib-2.0/schemas`.

(2)
You can add other gsettings keys and values inside your customzed gschema override file, 90_Custom.gschema.override. Remember to use single quotes for sting values. Use true (lowercase, without quotes) for True values, and use false (lowercase, without quotes) for False. Do not use quotes for integer values. Use brackets [ '...', '...', '...' ] for lists.

MORE EXAMPLES
----------------------------------------------

You can figure out what these do, so I won't describe them all. However, notice that the gsettings schema is listed ONCE in angle brackets [], and the keys and values for that schema are all listed below it.

[org.gnome.shell]

always-show-log-out = true

enabled-extensions = ['<email address hidden>', '<email address hidden>', '<email address hidden>', '<email address hidden>', '<email address hidden>', '<email address hidden>']

favorite-apps = ['firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.gedit.desktop', 'org.gnome.Terminal.desktop', 'libreoffice-writer.desktop', 'libreoffice-calc.desktop', 'org.gnome.Calculator.desktop', 'org.gnome.Screenshot.desktop', 'gnome-system-monitor.desktop']

[org.gnome.settings-daemon.plugins.xsettings]

antialiasing = 'rgba'

hinting = 'full'

[org.gnome.desktop.wm.preferences]

button-layout = 'close,minimize,maximize:appmenu'

Revision history for this message
Paul (cubicuser408) said :
#3

Thank you PJSingh5000! The info in both parts was very useful and I was able to figure out what I needed to do!

Revision history for this message
Paul (cubicuser408) said :
#4

Thanks PJSingh5000, that solved my question.