This function sends the configuration for your wallpaper to the companion app. It takes a "settings" array containing your options/sections, where each option/section is a struct.
The array should have the following format:
array =
[
{section_or_option},
{section_or_option},
{section_or_option}
];
Each entry in this array is either a section or an option.
A section struct requires the following format:
{
type: "section",
name: "unique_identifier",
label: "Label for this section in the companion app",
children: [{section}, {option}, ...]
}
The children property in a section struct is an array. Each entry in this array is either another section struct or an option struct.
An option struct requires the following format:
{
type: "type_of_return_value",
name: "unique_identifier",
label: "Label for this section in the companion app"
}
The following types are allowed for the type property: "range", "boolean", "string", "string_multiline", "color" (or "colour"), "file" and "folder".
Depending on the type, you must provide extra properties to the option struct:
{
type: "range",
value: <a number, default value>,
min: <a number, minimum range value>,
max: <a number, maximum range value>,
step: <a number, distance between possible values>
}
{
type: "boolean",
value: <true or false, default value>
}
{
type: "string",
value: <a string, default value>
}
{
type: "string_multiline",
value: <a string that can have newlines, e.g. "Line 1\nLine 2\nLine 3\nLine4">
}
{
type: "colour",
value: <a colour, default value>
}
{
type: "file",
value: <a string containing file path, e.g. "C:\\Users\\MyUser\\Pictures\\MyPicture.png">
}
{
type: "folder",
value: <a string containing a folder path, e.g. "C:\\Users\\MyUser\\Pictures\\">
}
wallpaper_set_config(settings_array);
Argument | Type | Description |
---|---|---|
settings_array | Array | An array containing section and option structs as detailed above |
N/A
var _config =
[
{
type: "section",
name: "animation",
label: "Animation",
children:
[
{
type: "range",
name: "speed",
label: "Rotation speed",
value: 50,
min: 0,
max: 200,
step: 25
},
{
type: "boolean",
name: "clockwiseRotation",
label: "Clockwise rotation",
value: false
},
{
type: "boolean",
name: "pause",
label: "Pause animation",
value: true
}
]
},
{
type: "section",
name: "colours",
label: "Colours",
children:
[
{
type: "colour",
name: "blendColor",
label: "Blend colour",
value: #FA1E4E
},
{
type: "range",
name: "blendAlpha",
label: "Blend alpha",
value: 100
}
]
}
];
wallpaper_set_config(_config);
The code above shows an example of the wallpaper_set_config function with two sections. The first section contains three options (a range and two booleans) and the second section contains two options (a colour and a range).
This example initialises the array first in a local variable, and passes that into the function call. You can skip the variable stuff and initialise the array in the function arguments directly if you wish to do so.