notesy::settings

The plugin's settings, as the user left them on its settings page. The settings themselves are declared in the manifest ([[settings]], see plugin.toml); notesy draws the page for them. Needs no permission.

rustuse notesy::{log, settings};

pub fn ready() {
    let goal = settings::get("goal")?;
    log::info(`aiming for ${goal} words`);
}

pub fn setting_changed(key) {
    log::info(`${key} is now ${settings::get(key)?}`);
}
Function What it does
settings::get(key) The setting key: its value as the user set it, or its default. None for a key the manifest doesn't declare.
settings::set(key, value) Sets its setting key as though the user had, on its page: a list of places its panel adds to, say. The value has the setting's type; a secret one is the user's to type, and can't be set.
settings::on_suggest(handler) handler(key, text) once typing pauses in the field for a new item of a list setting with suggest = true: it answers with settings::suggest, then or once it knows.
settings::suggest(key, text, items) What it suggests for text in setting key's field, as a view's suggest takes them (notesy::view): text, or #{ text, detail, icon, value }. A pick adds its value (its text, unless the value is text).

Values have the setting's type: a switch is true or false, a number an integer or a float, a text field a string, a multi-choice or list a vector of strings, a color a #rrggbb string.

A secret setting (a token, a password) is kept in the system keychain, not the store; settings::get reads it from there. A script's own secrets are in notesy::secrets.

When the user changes a setting, the script's setting_changed(key) is called (Scripts), after notesy has read the new value, so settings::get(key) returns it.

Every page