WM Keyboard plugins
Plugins are small sandboxed Python scripts that add tools to the keyboard.
A plugin is a small Python script that adds a tool to the keyboard. It draws a panel (some text, a few buttons, maybe a text box) and does whatever you write it to do.
def render(): return ui.column( ui.label("Hello!", style="title"), ui.button("wave", "Wave back"), )
def on_event(e): if e.id == "wave": wm.log("👋")That is a complete plugin, minus its plugin.json.
You can also write one on the phone. WM Keyboard Tools Plugins Write a plugin opens an in-app editor with a live preview and starter templates, and its Install button installs the result directly, with no ZIP file.
Start here
Section titled “Start here”What a plugin can do
Section titled “What a plugin can do”Compute things, draw its own panel, and add buttons to the bar over selected text. A plugin can also be nothing but those buttons: a selection action that turns the text you selected into something else, which is also how a Clink action installs.
Plugins written for API 5 (the wm package) can be
whole tools: a tile on the toolbar, a floating box, a key or a keyword that
opens them, timers while they are open, and, when you allow it, the internet,
your AI model, the text you are writing, the clipboard, your location or files
you pick. Each of those is a permission you see before
install, and the ones that can read your things or send them away stay off
until you turn them on.
What a plugin cannot do
Section titled “What a plugin cannot do”- See what you type. There is no key event API. A plugin cannot observe, change or delay a single keystroke going to your app.
- Read the text you are writing in by itself. Even with
field.readallowed, a plugin reads the field only while it answers something you did in its panel, and never a password field or incognito text. - Reach the internet without you.
networkis off until you allow it, and then reaches only the websites the plugin listed. Data saver stops it. - Reach Android. No file paths, no reflection, no other apps. Only the named
calls in the
wmpackage. - Run in the background. A plugin only runs while its panel or floating box is open. A reminder is a line of text the app shows; the plugin does not run for it.
Text still gets into a plugin: you type into its box, tap Paste on it, or select text and tap one of its buttons on the selection bar. Results come back out when you tap Insert under a result, or in place of the selection. Every one of those is a deliberate tap, on a control the keyboard drew.
Trying the examples
Section titled “Trying the examples”The five demo plugins in the
addon repository
are meant to be read. Each one is a single main.py:
| Plugin | Shows |
|---|---|
| Cipher Tool | Tabs, inputs, buttons, insertable output. The getting-started build. |
| UI Kitchen Sink | Every widget and every event, with a live event log. |
| Todo List | wm.storage, wm.reminders, json and the date widget: items with due dates, and a reminder when one is due. |
| Text Tools | The paste-in, transform, insert-out flow. |
| Math Mode | A real text engine: a tokenizer, symbol tables, a live result on every keystroke, and options kept in wm.storage. |
A new plugin in the editor can start from most of these, and from two written
for API 5: Text generator (placeholder words,
sentences and paragraphs, drawn with callbacks and plugin.state) and
Weather (a forecast from Open-Meteo, with internet access to two listed
websites, a setting, a timer and a header button).
Lua plugins were retired
Section titled “Lua plugins were retired”Plugins were written in Lua until version 0.6.6, which replaced Lua with Python. When you update to 0.6.6, every Lua plugin on the phone is removed, since nothing is left to run it. The keyboard’s plugin list and the Plugins screen say which ones went.
What each one saved is kept. Install a Python plugin with the same id and its
data comes back as it was. The five demos above kept their ids in the move, so
installing the Python Todo List brings your list back. Only what a plugin
saved with wm.storage is kept; its log and any reminders it had set are not.
Data that no plugin has claimed is listed on the Plugins screen, each with a button to delete it now. Anything still unclaimed 90 days after the update is deleted on its own.
WM Keyboard Tools Plugins Manage pluginsA Lua plugin file opened after the update is refused with a reason that says it was written in Lua; Lua is refused has the exact rule.
