Skip to content

Loading a profile & setting invidual backgrounds per monitor

Jan W edited this page Nov 29, 2021 · 1 revision

In this example a profile is received via MQTT as string (e.g. Green.orp), set as active profile using the OpenRGB sink, and also used to derive different wallpapers for each of 2 connected screens.

Note the mapping transformation in the Transformations property of the Wallpaper sink. It has 2 mapping expressions. The first one maps the string Green.orp to the object {"0": "wayne-tower-green-led.jpg", "1": "batmobile-green.jpg"}. The wallpaper sink can consume these kind of objects, where each key is a valid screen index and each value a valid file path (which - given it is a relative path - is appended to the RelativeTo property on the sink). The second mapping returns a default wallpaper for all screens if no other mapping is matched. The mapping transformation always returns the to value from the first expression matching the input value.

// allmylightsrc.json
{
  "Sources": [
    {
      "Type": "Mqtt",
      "Server": "192.168.168.1",
      "Port": 1883,
      "Topics": {
        "Result": "openrgb/profile"
      }
    }
  ],
  "Sinks": [
    {
      "Type": "OpenRGB",
      "Server": "127.0.0.1",
      "Port": 6742
    },
    {
      "Type": "Wallpaper",
      "RelativeTo": "C:\\Users\\bruce\\wayne-foundation\\Pictures\\Wallpaper",
      "Transformations": [
        {
          "Type": "Mapping",
          "Mappings": [
            {
              "From": "Green.orp",
              "To": {
                "0": "wayne-tower-green-led.jpg",
                "1": "batmobile-green.jpg"
              }
            },
            {
              "From": ".+",
              "To": "gotham-city.jpg"
            }
          ]
        }
      ]
    }
  ]
}