Plugin types
Info provider plugins
Provide structured information like weather, media playback, or Docker stats:- Display in the main UI
- Export to JSON output
- Use in compact format templates
Output format plugins
Add new export formats like YAML, Markdown, or custom formats:- Format system data for output
- Define file extensions
- Support multiple format variants
Creating an info provider plugin
Here’s a complete example of a weather plugin that fetches and displays weather information.Plugin configuration
Create a configuration file for your plugin at~/.config/draconis++/plugins/weather.json:
Using the cache system
ThePluginCache class provides efficient caching with automatic expiry:
Building your plugin
Static linking
For static builds, compile with-DDRAC_STATIC_PLUGIN_BUILD:
Dynamic linking
For dynamic plugins, compile as a shared library:.so file in ~/.local/share/draconis++/plugins/.
Testing your plugin
Test your plugin with the--list-plugins and --plugin-info commands:
Best practices
Cache expensive operations
Cache expensive operations
Always cache network requests and slow operations. Use appropriate TTL values:
- Weather data: 30-60 minutes
- Media playback: 5-10 seconds
- System metrics: 1-5 seconds
Handle errors gracefully
Handle errors gracefully
Return errors through the
Result type and store them in m_lastError for doctor mode reporting.Provide meaningful icons
Provide meaningful icons
Use Nerd Fonts icons for consistent UI appearance. Include trailing space for alignment.
Prefix field names
Prefix field names
Prefix all field names with your provider ID to avoid conflicts:
- Good:
weather_temp,weather_city - Bad:
temp,city
Document dependencies
Document dependencies
Clearly specify plugin dependencies in metadata so users know what’s required.