Skip to content

js/background: Add Multi-Display Wallpaper

Taufiq Pohan requested to merge taufiq30s/gnome-shell:js/background into main

Description

Based on this issue #4929, I create a feature that allows users to apply a different wallpaper to each monitor.

For the implementation, I changed the data type in gsetting-schemas for uriBackground to an array of strings.

Then for the selection of image files to be applied, it will be based on the monitor index, and if the element in the uri is only 1 or the number of monitors more than the length of uriBackgrounds, it will directly read the index 0 and the monitor index will be set to 0.

Preview

Preview Result

How to set multi-wallpaper

You can run this command in your terminal

gsettings set org.gnome.desktop.background picture-uri-dark "['file:///usr/share/backgrounds/gnome/adwaita-d.webp', 'file:///usr/share/backgrounds/gnome/keys-d.webp']"

To use the above command, you must change the file org.gnome.desktop.background.gschema.xml.in, change type of picture-uri and picture-uri-dark from s to as. For example:

Before

    <key name="picture-uri" type="s">
      <default>'file://@datadir@/backgrounds/gnome/adwaita-l.jpg'</default>
      <summary>Picture URI</summary>
      <description>
        URI to use for the background image. Note that the backend only supports
        local (file://) URIs.
      </description>
    </key>
    <key name="picture-uri-dark" type="s">
      <default>'file://@datadir@/backgrounds/gnome/adwaita-d.jpg'</default>
      <summary>Picture URI (dark)</summary>
      <description>
        URI to use for the background image. Note that the backend only supports
        local (file://) URIs.
      </description>
    </key>

After

    <key name="picture-uri" type="as">
      <default>
      [
        'file://@datadir@/backgrounds/gnome/adwaita-l.webp',
        'file://@datadir@/backgrounds/gnome/keys-l.webp'
      ]
      </default>
      <summary>Picture URI</summary>
      <description>
        URI to use for the background image. Note that the backend only supports
        local (file://) URIs.
      </description>
    </key>
    <key name="picture-uri-dark" type="as">
      <default>
      [
        'file://@datadir@/backgrounds/gnome/adwaita-d.webp',
        'file://@datadir@/backgrounds/gnome/keys-d.webp'
      ]
      </default>
      <summary>Picture URI (dark)</summary>
      <description>
        URI to use for the background image. Note that the backend only supports
        local (file://) URIs.
      </description>
    </key>

Signed-off-by: Taufiq Pohan m.taufiq30s@hotmail.com

Edited by Taufiq Pohan

Merge request reports