Want to group your pictures into light/dark wallpapers, that switches automatically when you change system light/dark style? Here’s how to do the trick in GNOME 42 desktop!
GNOME 42 comes with new “Appearance” settings page allows to switch between Light and Dark style. As well, each wallpaper (GNOME’s default) includes 2 picture files that follows system color style.
If you want to add your own pictures as light/dark wallpaper, simply create a XML configuration file to the right place. See following steps for details.
NOTE: this tutorial does not work in Ubuntu 22.04, because it uses customized Appearance settings page.
Option 1: Create Light/Dark wallpapers for all users
To allow all systems users to use the new wallpapers, add the XML file into “
1.) Firstly, press Windows (Super) key on keyboard to open the overview screen. Then search for and launch a terminal window.
2.) When terminal opens, run the command below to create and edit a XML file (change file name jammy to yours):
sudo gnome-text-editor /usr/share/gnome-background-properties/jammy.xml
gnome-text-editor is GNOME 42's default text editor. Replace it if your system come without it.
When the file opens, add following lines:
<?xml version="1.0"?> <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd"> <wallpapers> <wallpaper deleted="false"> <name>TYPE_NAME_HERE</name> <filename>/PATH/TO/PICTURE_LIGHT</filename> <filename-dark>/PATH/TO/PICTURE_DARK</filename-dark> <options>zoom</options> <shade_type>solid</shade_type> <pcolor>#3465a4</pcolor> <scolor>#000000</scolor> </wallpaper> </wallpapers>
Type a name in “
<name>” section, and insert file path of picture for light mode between
</filename>. Also, add file path for dark mode in
Tip 1: press Ctrl+L in file manager allows to copy current folder path. Tip 2: Drag & drop file into terminal will insert the file path, so you may copy & paste it to anywhere else.
After saving the file, you should see the new wallpaper in ‘Appearance‘ (need to refresh, switch to another tab and then back) settings page.
Option 2: Light/Dark wallpaper for current user only:
To add wallpapers for current user only, or for user does not have administrator (
sudo) permission. Create the file under “~/.local/share/gnome-background-properties”.
1.) Firstly open terminal by searching from Activities overview. Then run command to create that folder as it does not exist out-of-the-box:
mkdir -p ~/.local/share/gnome-background-properties
Next, open the folder in file manager. It’s hidden by default. Press Ctrl+H to navigate or run the command below in terminal to open it:
2.) When you at that folder, create a file with .xml extension, and put the lines (see Option 1) into file and save it.
Do change the file path in
<filename-dark> sections to yours!
Tip: GNOME does not has "New Document" option by default. See this how to guide to enable it.
That’s all. Enjoy!