Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ryzhpolsos/redeye/llms.txt

Use this file to discover all available pages before exploring further.

IPluginManager coordinates plugin loading and acts as a shared registry for widgets and expression functions. Plugins use it to publish their own exports under namespaced names and to consume exports from other plugins. Every plugin accesses it through the PluginManager property on the Plugin base class — you do not need to look it up yourself.

IPluginManager interface

IPluginManager lives in the RedEye.Core namespace and extends IComponent.

GetPlugin

Returns metadata for a loaded plugin by its unique identifier.
PluginInfo GetPlugin(string id);
id
string
required
The unique plugin ID as declared in the plugin’s metadata. Typically formatted as a reverse-domain string, e.g. "com.example.myplugin".
ReturnsPluginInfo: the plugin’s metadata object, or null if no plugin with that ID is loaded.

GetPlugins

Returns metadata for every currently loaded plugin.
IEnumerable<PluginInfo> GetPlugins();
ReturnsIEnumerable<PluginInfo>: a sequence of PluginInfo objects, one per loaded plugin.

GetExportedWidget

Looks up a widget type exported under the given name.
Type GetExportedWidget(string name);
name
string
required
The fully qualified export name, e.g. "MyPlugin.StatusBar". The Plugin base class prefixes the plugin name automatically when you call ExportWidget.
ReturnsType: the exported widget Type, or null if no widget is registered under that name.

GetExportedWidgets

Returns the full registry of exported widget types, keyed by export name.
IDictionary<string, Type> GetExportedWidgets();
ReturnsIDictionary<string, Type>: a dictionary mapping export name to widget type.

ExportWidget

Registers a widget type under the given name so that layout XML can reference it by that name.
IPluginManager ExportWidget(string name, Type widget);
name
string
required
The name under which the widget is exported. When called from the Plugin base class helper ExportWidget<T>(name), the plugin’s own name is prepended automatically, producing "PluginName.name".
widget
Type
required
The Type of a class that implements IShellWidget.
ReturnsIPluginManager: the same manager instance, enabling method chaining.
Prefer the generic ExportWidget<T>(string name) helper on the Plugin base class over calling IPluginManager.ExportWidget directly. The helper namespaces the export name under your plugin automatically.

GetExportedFunction

Looks up an expression function exported under the given name.
Func<IEnumerable<object>, IVariableStorage<string>, object> GetExportedFunction(string name);
name
string
required
The fully qualified export name, e.g. "MyPlugin.formatBytes".
ReturnsFunc<IEnumerable<object>, IVariableStorage<string>, object>: the exported function delegate, or null if not found.

GetExportedFunctions

Returns the full registry of exported expression functions.
IDictionary<string, Func<IEnumerable<object>, IVariableStorage<string>, object>> GetExportedFunctions();
ReturnsIDictionary<string, Func<...>>: a dictionary mapping export name to function delegate.

ExportFunction

Registers a function delegate under the given name. The function becomes callable as an expression inside layout XML markup.
IPluginManager ExportFunction(
    string name,
    Func<IEnumerable<object>, IVariableStorage<string>, object> func
);
name
string
required
The name under which the function is exported. When called via the Plugin base class helper ExportFunction(name, func), the plugin name is prepended automatically.
func
Func<IEnumerable<object>, IVariableStorage<string>, object>
required
The function implementation. The first argument is the list of positional arguments passed from the expression; the second is the variable storage context from the calling config node.
ReturnsIPluginManager: the same manager instance, enabling method chaining.

LoadPlugins

Scans the plugins/ directory, loads plugin assemblies, resolves dependencies in declaration order, and calls Main() on each plugin.
void LoadPlugins();
LoadPlugins() is called once by the shell on startup. Do not call it from plugin code.

PluginInfo class

PluginInfo carries static metadata about a plugin. The shell populates these fields from the plugin’s assembly and declaration before calling Main().
Id
string
Unique identifier for the plugin. Typically a reverse-domain string such as "com.example.myplugin".
Name
string
Human-readable display name. This is also the prefix used when the Plugin base class registers exports, so a plugin named "MyPlugin" exports as "MyPlugin.WidgetName".
RequiredAssemblies
IEnumerable<string>
Assembly file names that must be present alongside the plugin. The plugin loader ensures these are loaded before the plugin’s own assembly.
Dependencies
IEnumerable<string>
IDs of other plugins that this plugin depends on. The loader resolves this list to determine initialization order.

Accessing IPluginManager in a plugin

The Plugin base class resolves IPluginManager during InitPlugin() and exposes it as the protected PluginManager field. You can use it directly, or use the convenience helpers ExportWidget<T> and ExportFunction which handle namespacing for you.
public class MyPlugin : Plugin
{
    public override void Main()
    {
        // Export a widget — registers as "MyPlugin.StatusBar"
        ExportWidget<StatusBarWidget>("StatusBar");

        // Export a function — registers as "MyPlugin.formatBytes"
        ExportFunction("formatBytes", (args, vars) =>
        {
            long bytes = Convert.ToInt64(args.First());
            return (bytes / 1024.0 / 1024.0).ToString("F1") + " MB";
        });
    }
}

Consuming another plugin’s exports

public override void Main()
{
    // Check whether a specific plugin is loaded
    PluginInfo info = PluginManager.GetPlugin("com.example.otherplugin");
    if (info is null)
    {
        Logger.LogWarning("OtherPlugin is not loaded.");
        return;
    }

    // Call a function exported by another plugin
    var fn = PluginManager.GetExportedFunction("OtherPlugin.compute");
    if (fn is not null)
    {
        object result = fn(new object[] { 42 }, Config.GetRootNode());
        Logger.LogInfo("Result: " + result);
    }
}

Listing all loaded plugins

foreach (PluginInfo plugin in PluginManager.GetPlugins())
{
    Logger.LogInfo($"Loaded: {plugin.Name} ({plugin.Id})");
}

Exporting widgets

Step-by-step guide to building and registering custom widget types.

Exporting functions

How to expose C# functions as callable expressions in layout XML.

Build docs developers (and LLMs) love