Documentation
¶
Index ¶
- Constants
- type KeyBinding
- type Manager
- func (m *Manager) AllSettingValues() map[string]map[string]interface{}
- func (m *Manager) Bindings(area string) []KeyBinding
- func (m *Manager) CallBodyRenderHook(email *lua.LTable, rendered, raw string) string
- func (m *Manager) CallComposerHook(event string, body, subject, to, cc, bcc string)
- func (m *Manager) CallFolderHook(event string, folderName string)
- func (m *Manager) CallHook(event string, args ...lua.LValue)
- func (m *Manager) CallKeyBinding(binding KeyBinding, args ...lua.LValue)
- func (m *Manager) CallSendHook(event string, to, cc, subject, accountID string)
- func (m *Manager) Close()
- func (m *Manager) EmailToTable(uid uint32, from string, to []string, subject string, date time.Time, ...) *lua.LTable
- func (m *Manager) GetSettingValue(plugin, key string) (interface{}, bool)
- func (m *Manager) LoadPlugins()
- func (m *Manager) LoadSettingValues(values map[string]map[string]interface{})
- func (m *Manager) LuaState() *lua.LState
- func (m *Manager) Plugins() []string
- func (m *Manager) ResolvePrompt(prompt *PendingPrompt, input string)
- func (m *Manager) Schema(plugin string) []SettingDef
- func (m *Manager) Schemas() []PluginSettings
- func (m *Manager) SetSettingValue(plugin, key string, val interface{}) bool
- func (m *Manager) StatusText(area string) string
- func (m *Manager) TakePendingFields() map[string]string
- func (m *Manager) TakePendingNotification() (PendingNotification, bool)
- func (m *Manager) TakePendingPrompt() (*PendingPrompt, bool)
- type PendingNotification
- type PendingPrompt
- type PluginSettings
- type SettingDef
- type SettingType
Constants ¶
const ( HookStartup = "startup" HookShutdown = "shutdown" HookEmailReceived = "email_received" HookEmailSendBefore = "email_send_before" HookEmailSendAfter = "email_send_after" HookEmailViewed = "email_viewed" HookFolderChanged = "folder_changed" HookComposerUpdated = "composer_updated" HookEmailBodyRender = "email_body_render" )
Hook event names.
const ( StatusInbox = "inbox" StatusComposer = "composer" StatusEmailView = "email_view" )
Status area names.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyBinding ¶ added in v0.30.0
type KeyBinding struct {
Key string
Area string // "inbox", "email_view", or "composer"
Description string
Fn *lua.LFunction
Plugin string
}
KeyBinding represents a plugin-registered keyboard shortcut.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages the Lua VM and loaded plugins.
Manager is not safe for concurrent use. The Lua VM itself is single- threaded, and all hook callbacks, key-binding invocations, and API calls must be dispatched from the same goroutine that owns the Manager (the orchestrator). Mutable Manager state (hooks, stores, bindings, currentPlugin, pending* fields) is therefore unprotected by design; callers that need to drive plugin events from multiple goroutines must serialize access externally.
func (*Manager) AllSettingValues ¶ added in v0.38.0
AllSettingValues returns a deep copy of all plugin setting values.
func (*Manager) Bindings ¶ added in v0.30.0
func (m *Manager) Bindings(area string) []KeyBinding
Bindings returns all plugin-registered key bindings for the given view area.
func (*Manager) CallBodyRenderHook ¶ added in v0.37.0
CallBodyRenderHook runs all email_body_render callbacks, threading the body string through each. Callbacks receive (email_table, rendered, raw):
- rendered: the current display string (ANSI-styled, post-HTML→terminal)
- raw: the original message body (HTML or plain text, same string fed to the renderer) — useful for parsing the source instead of the rendered output
A callback may return a string to replace the rendered body, or nil to leave it unchanged. Non-string returns are ignored. Multiple callbacks chain in registration order; each subsequent callback sees the previous callback's rendered output, but always the same raw source.
func (*Manager) CallComposerHook ¶
CallComposerHook calls a hook with composer state info.
func (*Manager) CallFolderHook ¶
CallFolderHook calls a hook with a folder name.
func (*Manager) CallKeyBinding ¶ added in v0.30.0
func (m *Manager) CallKeyBinding(binding KeyBinding, args ...lua.LValue)
CallKeyBinding invokes a plugin key binding callback with the given arguments.
func (*Manager) CallSendHook ¶
CallSendHook calls a hook with email send metadata.
func (*Manager) EmailToTable ¶
func (m *Manager) EmailToTable(uid uint32, from string, to []string, subject string, date time.Time, isRead bool, accountID string, folder string) *lua.LTable
EmailToTable converts email fields into a Lua table.
func (*Manager) GetSettingValue ¶ added in v0.38.0
GetSettingValue returns the current value (or default) for a plugin setting.
func (*Manager) LoadPlugins ¶
func (m *Manager) LoadPlugins()
LoadPlugins discovers and loads plugins from ~/.config/matcha/plugins/.
func (*Manager) LoadSettingValues ¶ added in v0.38.0
LoadSettingValues replaces in-memory values with the given snapshot. Values for unknown plugins/keys are kept as-is so freshly-disabled plugins don't lose their saved settings on next launch.
func (*Manager) ResolvePrompt ¶ added in v0.31.0
func (m *Manager) ResolvePrompt(prompt *PendingPrompt, input string)
ResolvePrompt calls the stored prompt callback with the user's input.
func (*Manager) Schema ¶ added in v0.38.0
func (m *Manager) Schema(plugin string) []SettingDef
Schema returns the schema for a single plugin.
func (*Manager) Schemas ¶ added in v0.38.0
func (m *Manager) Schemas() []PluginSettings
Schemas returns all plugin setting schemas, sorted by plugin name.
func (*Manager) SetSettingValue ¶ added in v0.38.0
SetSettingValue updates a plugin setting in-memory. Coerces value to the declared type. Returns false if the plugin/key is unknown.
func (*Manager) StatusText ¶
StatusText returns the plugin status string for the given view area.
func (*Manager) TakePendingFields ¶ added in v0.30.0
TakePendingFields returns and clears any pending compose field updates.
func (*Manager) TakePendingNotification ¶
func (m *Manager) TakePendingNotification() (PendingNotification, bool)
TakePendingNotification returns and clears any pending notification.
func (*Manager) TakePendingPrompt ¶ added in v0.31.0
func (m *Manager) TakePendingPrompt() (*PendingPrompt, bool)
TakePendingPrompt returns and clears any pending prompt request.
type PendingNotification ¶
PendingNotification holds a notification message and its display duration.
type PendingPrompt ¶ added in v0.31.0
type PendingPrompt struct {
Placeholder string
// contains filtered or unexported fields
}
PendingPrompt holds the state for a plugin-requested user input prompt.
type PluginSettings ¶ added in v0.38.0
type PluginSettings struct {
Plugin string
Defs []SettingDef
}
PluginSettings holds the schema for one plugin's settings, ordered by declaration order so the TUI lists them predictably.
type SettingDef ¶ added in v0.38.0
type SettingDef struct {
Key string
Type SettingType
Default interface{}
Label string
Description string
}
SettingDef describes a single configurable plugin setting.
type SettingType ¶ added in v0.38.0
type SettingType string
SettingType identifies the kind of value a plugin setting holds.
const ( SettingBool SettingType = "boolean" SettingNumber SettingType = "number" SettingString SettingType = "string" )