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: Returns in-memory collections with zero disk I/O overhead.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 both IAliasProvider and ITranslationProvider.
Key Implementation Highlights
- Alphabet Boundaries (
InputRanges/OutputRanges): Declares CJK Ideograph blocks as the input range 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. - Polyphonic Combinations (
GetAliases(text)): Constructs a syllable map and generates all common pronunciation combinations connected with|(capped at 32 combinations to prevent combinatorial explosions), allowing parallel matching across all permutations. - 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 seamlessly.
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 within Lertaro's user data directory, communicating via named pipes using JSON-RPC without polluting the system PATH.
- 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.