Skip to content

Transforms

A transform changes how Tuner.Setting reads and writes the key. It is set via the transform property of the binding.

Tuner.ValueTransform

Binds a boolean widget (usually Tuner.Switch) to a string key: the switch is on when the key equals value. Turning it on writes value, turning it off resets the key to its default.

blp
Tuner.Switch {
    title: _("Light Style");

    binding: Tuner.Setting {
        schema-id: "org.gnome.desktop.interface";
        schema-key: "color-scheme";

        transform: Tuner.ValueTransform {
            value: "prefer-light";
        };
    };
}

Tuner.FlagsTransform

Binds a boolean widget to a single element of a string array key: the switch is on when value is present in the array. Set inverse to invert the logic.

blp
Tuner.Switch {
    title: _("Variable Refresh Rate");

    binding: Tuner.Setting {
        schema-id: "org.gnome.mutter";
        schema-key: "experimental-features";

        transform: Tuner.FlagsTransform {
            value: "variable-refresh-rate";
        };
    };
}

Tuner.PathTransform

Cleans up path values for display and expands them back on write:

  • hide-uri-prefix — strip file:// when showing, add it back when saving;
  • fold-home-path — show the home directory as ~, expand it when saving.

See the example on the Tuner.File page.

Released under the GPL-3.0+ License. The content is available under CC BY-SA 4.0, unless stated otherwise.