feat: convert to workspace with native plugin architecture
BREAKING: Restructure from monolithic binary to modular plugin ecosystem Architecture changes: - Convert to Cargo workspace with crates/ directory - Create owlry-plugin-api crate with ABI-stable interface (abi_stable) - Move core binary to crates/owlry/ - Extract providers to native plugin crates (13 plugins) - Add owlry-lua crate for Lua plugin runtime Plugin system: - Plugins loaded from /usr/lib/owlry/plugins/*.so - Widget providers refresh automatically (universal, not hardcoded) - Per-plugin config via [plugins.<name>] sections in config.toml - Backwards compatible with [providers] config format New features: - just install-local: build and install core + all plugins - Plugin config: weather and pomodoro read from [plugins.*] - HostAPI for plugins: notifications, logging Documentation: - Update README with new package structure - Add docs/PLUGINS.md with all plugin documentation - Add docs/PLUGIN_DEVELOPMENT.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
64
examples/plugins/hello-world/init.lua
Normal file
64
examples/plugins/hello-world/init.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
-- Hello World Plugin for Owlry
|
||||
--
|
||||
-- This minimal plugin demonstrates:
|
||||
-- 1. Using owlry.log for logging
|
||||
-- 2. Registering a static provider
|
||||
-- 3. Returning items with all available fields
|
||||
|
||||
owlry.log.info("Hello World plugin loading...")
|
||||
|
||||
-- Register a static provider
|
||||
-- Static providers have a 'refresh' function that returns items once
|
||||
owlry.provider.register({
|
||||
-- Required: unique provider name (used internally)
|
||||
name = "greeting",
|
||||
|
||||
-- Optional: human-readable display name
|
||||
display_name = "Hello World",
|
||||
|
||||
-- Optional: icon name (freedesktop icon spec)
|
||||
default_icon = "face-smile",
|
||||
|
||||
-- Optional: prefix to trigger this provider (e.g., ":hello")
|
||||
prefix = ":hello",
|
||||
|
||||
-- Required for static providers: function that returns items
|
||||
refresh = function()
|
||||
-- Get username from environment or default to "User"
|
||||
local user = os.getenv("USER") or "User"
|
||||
|
||||
return {
|
||||
{
|
||||
id = "greeting-1",
|
||||
name = "Hello, " .. user .. "!",
|
||||
description = "A friendly greeting from Lua",
|
||||
icon = "face-smile",
|
||||
-- Command to run when selected (optional)
|
||||
command = "notify-send 'Hello' 'Greetings from Owlry!'",
|
||||
-- Whether to run in terminal (optional, default false)
|
||||
terminal = false,
|
||||
-- Tags for search/filtering (optional)
|
||||
tags = { "greeting", "hello", "example" }
|
||||
},
|
||||
{
|
||||
id = "greeting-2",
|
||||
name = "Current time: " .. os.date("%H:%M:%S"),
|
||||
description = "The current system time",
|
||||
icon = "appointment-soon",
|
||||
-- Empty command = info only, no action
|
||||
command = "",
|
||||
tags = { "time", "clock" }
|
||||
},
|
||||
{
|
||||
id = "greeting-3",
|
||||
name = "Open Owlry docs",
|
||||
description = "Visit the Owlry documentation",
|
||||
icon = "help-browser",
|
||||
command = "xdg-open 'https://github.com/Owlibou/owlry'",
|
||||
tags = { "help", "docs", "documentation" }
|
||||
}
|
||||
}
|
||||
end
|
||||
})
|
||||
|
||||
owlry.log.info("Hello World plugin loaded successfully!")
|
||||
Reference in New Issue
Block a user