Settings Handler Payload Examples
See Example Payloads.
GET Request
The Settings Handler payload is a dictionary keyed by application ID, containing an array of “settings specifications.” Inside each of these, there are two supported keys: settings
and options
. The settings object contains a set of key/value pairs, which are implementation-specific and represent the settings to be set. The options payload is also implementation-specific, providing a place to specify configuration for the settings handler.
There is a general expectation that the keys hold "."-separated paths into a hierarchical structure, but there is no requirement that this be the case. A settings handler may operate a flat address space for its keys. A settings handler must guarantee to restore the settings that it manages to their original condition, when a payload provided by a previous GET operation (or the "oldValue" set of a SET operation) is provided back to a SET operation.
Also keep in mind that if you’re doing any of the standard lifecycle actions—start
, stop
, setSettings
, etc.—you should be delegating to the Lifecycle Manager to do so for you, rather than directly invoking Settings Handlers.
[ { "org.gnome.desktop.a11y.magnifier": [ { options: { schema: "org.gnome.desktop.a11y.magnifier" }, settings: { "cross-hairs-clip": null, "cross-hairs-color": null, "cross-hairs-length": null, "cross-hairs-opacity": null, "cross-hairs-thickness": null, "lens-mode": null, "mag-factor": null, "mouse-tracking": null, "screen-position": null, "scroll-at-edges": null, "show-cross-hairs": null } } }, { "org.gnome.desktop.contrast": [ { options: { schema: "org.gnome.desktop.interface" }, settings: { "gtk-theme": null, "icon-theme": null } }, { options: { schema: "org.gnome.desktop.background" }, settings: { "primary-color": null, "secondary-color": null } } } } ]
GET Response
[ { "org.gnome.desktop.a11y.magnifier": { settings: { "cross-hairs-clip": "false", "cross-hairs-color": "red", "cross-hairs-length": "20", "cross-hairs-opacity": "0.1", "cross-hairs-thickness": "10", "lens-mode": "true", "mag-factor": "12.2", "mouse-tracking": "push", "screen-position": "top-half", "scroll-at-edges": "true", "show-cross-hairs": "400" } } }, { "org.gnome.desktop.contrast": [ { options: { schema: "org.gnome.desktop.interface" }, settings: { "gtk-theme": "HighContrast", "icon-theme": "HighContrast } }, { options: { schema: "org.gnome.desktop.background" }, settings: { "primary-color": "#FFFFFFFFFFFF", "secondary-color": "#4a2c59f36e75" } } } } ]
SET Request
{ "org.gnome.desktop.a11y.magnifier": [ { settings: { "cross-hairs-clip": true, "cross-hairs-color": "rubbish", "cross-hairs-length": 4096, "cross-hairs-opacity": 0.2, "cross-hairs-thickness": 10, "lens-mode": true, "mag-factor": 12.2, "mouse-tracking": "push", "screen-position": "top-half", "scroll-at-edges": true, "show-cross-hairs": "9910192920" }, options: { schema: "org.gnome.desktop.a11y.magnifier" } } ] }
SET Response
{ "org.gnome.desktop.a11y.magnifier": [ { settings: { "cross-hairs-clip": { "oldValue": false, "value": true }, "cross-hairs-color": { "oldValue": "red", "value": "red", statusCode: 500, statusMessage: "Internal Error"}, "cross-hairs-length": { "oldValue": 20, "value": 4096 }, "cross-hairs-opacity": { "oldValue": "0.1", "value": "0.2" }, "cross-hairs-thickness": { "oldValue": "3", "value": "10" }, "lens-mode": { "oldValue": false, "value": true }, "mag-factor": { "oldValue": "0.4", "value": "12.2" }, "mouse-tracking": { "oldValue": "centered", "value": "push" }, "screen-position": { "oldValue": "none", "value": "top-half" }, "scroll-at-edges": { "oldValue": false, "value": true }, "show-cross-hairs": { "oldValue": true, "value": true, statusCode: 400 } } } ] }
More examples of SET payloads are available in the tests for settings handlers, e.g.: