Skip to main content
Extensions get their own isolated, type-safe settings store. Every plugin has its own namespace that the host persists across app restarts and plugin updates. Use it to store configuration your extension exposes to users. Unlike the global Settings service — which reads and writes Klyx’s own editor settings — PluginSettings is scoped to your plugin. Each value is a key -> value pair stored as a string.

Accessing the settings

PluginSettings is a per-plugin runtime service. Access it with by runtime():

Reading values

Typed getters return a default when the key is absent:
All getters except getString are non-null with sensible defaults. getString returns null when the key is absent and no default is provided.

Writing values

Typed putters persist the value immediately:
Remove keys with:

Observing changes

values is a reactive StateFlow that emits a new snapshot whenever any value changes:

Supported types

String, Int, Long, Float, Boolean, and Set<String> are supported out of the box. For anything else, serialize to a String yourself (for example with kotlinx.serialization) and use putString/getString.

Optional settings screen

An extension can expose a dedicated settings screen in the Klyx app. Registration is optional — the settings button only appears in the plugin’s details screen for plugins that register one. Register your settings UI with the PluginSettingsRegistry:
The registered composable is invoked by the host with your plugin’s typed PluginSettings as the receiver, so you can read and write values directly. The registration is removed automatically when your plugin unloads.

Security

Do not store secrets or sensitive data — API keys, tokens, passwords, credentials, or personal data — in settings. Settings are stored in plain text and can be read by anyone with access to the app’s data directory, exported by the user from the developer options, or inspected by other code running on the device. Treat every value you store here as public. Use the platform’s secure storage (for example the Android Keystore) for anything that must remain private.