Skip to content

Loading a profile & changing your background

Jan W edited this page Mar 18, 2021 · 3 revisions

This example shows the configuration for a setup in which an OpenRGB profile name (such as Movie.orp) is directly received via MQTT and consumed by an OpenRGB- and a Wallpaper sink.

Note the Mapping transformation added to the Transformations of the Wallpaper sink. The received profile names are mapped to file names and the last expression returns the file name of a default wallpaper in case none of the other expressions matches.

The wallpaper sink prepends the path provided in RelativeTo to any input value that is not an absolute path. Windows uses a backslash as directory separator. It is also used as an escape character in JSON, which is why it is required to use \\ instead of just one \.

// allmylightsrc.json

{
  "Sources": [
    {
      "Type": "Mqtt",
      "Server": "192.168.168.1",
      "Port": 1883,
      "Topics": {
        "Result": "stat/openrgb/profile"
      }
    }
  ],
  "Sinks": [
    {
      "Type": "OpenRGB",
      "Server": "127.0.0.1",
      "Port": 6742
    },
    {
      "Type": "Wallpaper",
      "RelativeTo": "C:\\Users\\brucewayne\\Pictures\\Wallpaper",
      "Transformations": [
        {
          "Type": "Mapping",
          "Mappings": [
            {
              "From": "Movie.orp",
              "To": "wayne-foundation.png"
            },
            {
              "From": "Gaming.orp",
              "To": "no-mans-sky.jpg"
            },
            {
              "From": ".+",
              "To": "default.jpg"
            }
          ]
        }
      ]
    }
  ]
}