Plugin Examples
To help developers understand how Lertaro.PluginSdk interfaces cooperate in real-world scenarios, this chapter analyzes four representative open-source plugins included in the Lertaro repository.
1. CoreExtensions —— Actions, Shell Menus & Quick Panel
The CoreExtensions plugin is Lertaro's core functionality bundle, implementing IPlugin, IActionProvider, IConfigurable, and multiple sub-providers.
Key Implementation Highlights
- Static Result Actions (
IActionProvider.GetActions()): Exposes the core file actions, including opening and locating items, copying paths and files, adding a result to Favorites, renaming items, shell commands, deletion, and administrator variants. - Native Shell Menu Integration (
IDynamicActionProvider): Interacts with Windows Shell COM interfaces viaShellMenuActionProvider, rendering full Windows context menus (with cascading submenus like "Send to", 7-Zip, VS Code) directly inside Lertaro'sCtrl+Oaction menu. - Schema-Driven Configuration Forms (
IConfigurable): Demonstrates defining configuration schemas with nested groups (Group), string lists (StringList), and hotkey recorders (Hotkey), rendering native UI forms in Settings without custom XAML. - Diverse Quick Panel Tabs (
IQuickPanelTabProvider):FavoritesTabProvider/HistoryTabProvider: serve the host's already-loaded favorites and history rather than re-reading them from disk; the history query is dispatched off the UI thread (Task.Run), so summoning the panel never waits on it.WindowsRecentTabProvider: Crawls the WindowsRecentfolder on a background thread, resolves COM shortcut targets, truncates results, and populatesMetadata.Modifiedfor accurate sorting.LastDirectoryTabProvider/RecentFilesTabProvider: Directly queries the host'sExplorerPathServiceandRecentFilesService.
2. PinyinAlias —— Non-ASCII Transliteration Engine
The PinyinAlias plugin provides full pinyin and initialism alias search support for Chinese filenames, implementing IAliasLiveMatcherProvider (an IAliasProvider) and ITranslationProvider.
Key Implementation Highlights
- Alphabet Boundaries (
InputRanges/OutputRanges): Declares one CJK Ideograph range (U+3007–U+9FFD) as the input boundary and lowercasea–zas the output range. The host uses these boundaries to partition mixed queries (e.g.大cjmatching大长今) into literal and alias segments. - Pre-flight Fast Checks (
CanHandle(text)): Scans for Chinese characters before generating aliases, returningfalseimmediately for pure English strings to avoid allocation overhead. - Live Reading Match (
IAliasLiveMatcherProvider): the readings are never written into the index. The plugin builds one immutable bit-parallel matcher per query term (2–63 ASCII letters/digits) and the host runs it over the candidate's own characters: every character consumes a non-empty prefix of one of its readings, so a hit is always one contiguous run and a polyphonic name costs nothing extra.GetAliases(text)now emits only the Simplified spelling of a Traditional name. - Embedded Localization & Thread-Safe Caching: Provides localized plugin display names via
ITranslationProvider, caching parsed JSON tables inside alock-guarded dictionary to avoid repeated disk reads.
3. FlowLauncherBridge —— Cross-Ecosystem Compatibility & Isolated Runtimes
The FlowLauncherBridge plugin demonstrates building a large-scale bridge system to integrate external community ecosystems into Lertaro.
Key Implementation Highlights
- Multi-Language IPC Bridge: Runs Flow Launcher plugins written in C# (.NET), Python 3.12, Node.js v20 LTS, and standalone executables (
.exe). - Isolated Self-Contained Runtimes: Deploys isolated Python and Node.js runtimes under Lertaro's shared data directory (
SharedDataDirectory\FlowData\PythonEmbeded-{arch}), not the per-user data folder. Each plugin talks to its interpreter over redirected standard input/output carrying JSON-RPC — there is no named pipe, and the system PATH is never touched. - Dynamic Configuration & WebView2 Previews: Dynamically maps external
SettingsTemplate.yaml/.jsonforms toPluginConfigSchema, and renders rich interactive HTML/WebView2 previews (e.g. MDict definitions, weather cards) inside QuickLook.
4. FileUnlocker —— File occupation release action
FileUnlocker demonstrates a focused action plugin that uses the Windows Restart Manager API through a small client wrapper.
Key Implementation Highlights
- Single-selection guard: The action is offered only for one existing file, avoiding ambiguous requests against folders or multiple results.
- Process inspection: It displays the locking process name, PID, and executable path, with a refresh operation for changing file state.
- Request-based release: The plugin asks the owning processes to release the file and disables the release button while no process is detected or an operation is running.
- Host-owned window frame: Its WPF view is placed in the SDK's themed
PluginWindowdialog, so the plugin does not duplicate theme, DPI, taskbar, or Alt+Tab handling.