Develop and debug

Keep your plugin where you work on it, let Fenn reload it on every save, and read the log when something looks wrong.

Dev mode

Turn on Plugin dev mode in Fenn's Settings (the card under the two columns). While it is on:

  • saving any file in a plugin's folder restarts that plugin and re-reads its plugin.toml (name, icon, size, page size);
  • a new plugin folder is loaded within a second, and a deleted one is unloaded. Changing id loads the plugin under its new id;
  • nothing needs a restart of Fenn.

Turn it off when you're done: it checks the plugin folders once a second while it's on.

Build Fenn from source

You need Fenn built from source to run it against your own plugin folder. It takes about five minutes on a fresh machine, most of it downloading the compiler.

Install the MSVC compiler and a Windows SDK from Visual Studio 2022 Build Tools:

powershell
winget install --id Microsoft.VisualStudio.2022.BuildTools -e --override "--quiet --wait --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended"

Install Rust. rustup installs the pinned MSVC toolchain on the first build:

powershell
winget install --id Rustlang.Rustup -e

Then build and run from the Fenn folder. Press Ctrl + Alt + N to pin the panel open.

powershell
cargo run --release

Run Fenn against your folder

Point Fenn at the folder that contains your plugin, then run it from a terminal:

powershell
$env:FENN_PLUGIN_PATH = "C:\code\my-plugins"     # ; separates folders
$env:FENN_PLUGIN_DEV  = "1"                       # dev mode, without touching Settings
cargo run --release -- --pinned --page=plugin:hello

FENN_PLUGIN_DEV=1 (or --plugin-dev) turns dev mode on for that run, whatever Settings say. --page=plugin:<id> opens on your page.

Plugins are searched for in this order: %APPDATA%\Fenn\plugins, plugins\ next to fenn.exe, then each folder in FENN_PLUGIN_PATH. If two plugins have the same id, the first one found wins.

Test without Fenn

Your plugin is just a program, so send it messages yourself:

powershell
'{"type":"event","id":"wave","kind":"click"}' | python main.py

Read the log

%APPDATA%\Fenn\fenn.log has every plugin's stderr, its log messages and each line Fenn couldn't parse, with the reason (for example bad "button" view: missing field id). Set FENN_LOG=debug for more.

When it crashes

Fenn restarts the plugin up to three times a minute. After that the tile shows Stopped · click to restart, and hovering over it shows the error and the last lines of stderr. The page shows the same details with a Restart button.

Most first-run problems are a missing flush (the tile never appears), a print that isn't JSON (the line is skipped), or a program that isn't on PATH (the tile says it couldn't start).

Report a bug

Sent with the page you’re on (/docs/develop) and your browser’s name.