pub struct PluginContext {
pub config: PluginConfigData,
pub state: Arc<Mutex<PluginSharedState>>,
pub logger_name: String,
pub commands: Arc<Mutex<Vec<RemoteCommand>>>,
}Expand description
Context provided to plugins for interacting with the terminal
Fields§
§config: PluginConfigDataPlugin-specific configuration
state: Arc<Mutex<PluginSharedState>>Shared terminal state
logger_name: StringLogger name for this plugin
commands: Arc<Mutex<Vec<RemoteCommand>>>Queue of commands to be sent to the client/daemon
Implementations§
Source§impl PluginContext
impl PluginContext
Sourcepub fn new(
config: PluginConfigData,
state: Arc<Mutex<PluginSharedState>>,
logger_name: impl Into<String>,
) -> Self
pub fn new( config: PluginConfigData, state: Arc<Mutex<PluginSharedState>>, logger_name: impl Into<String>, ) -> Self
Create new plugin context
Sourcepub fn queue_command(&self, cmd: RemoteCommand)
pub fn queue_command(&self, cmd: RemoteCommand)
Queue a command to be sent to the client or daemon
Sourcepub fn get_cursor(&self) -> (u16, u16)
pub fn get_cursor(&self) -> (u16, u16)
Get cursor position
Sourcepub fn set_data(&self, key: impl Into<String>, value: impl Into<String>)
pub fn set_data(&self, key: impl Into<String>, value: impl Into<String>)
Store plugin-specific data
Sourcepub fn log(&self, level: LogLevel, message: &str)
pub fn log(&self, level: LogLevel, message: &str)
Log a message with the integrated logging system
Messages are sent to both the Rust logging infrastructure (using the log crate)
and queued as a remote command to be forwarded to connected clients for display.
Sourcepub fn notify(&self, title: &str, body: &str, level: NotifyLevel)
pub fn notify(&self, title: &str, body: &str, level: NotifyLevel)
Send a notification to the user
Notifications are displayed as UI overlays in the client with auto-dismiss after 5 seconds. The notification level determines the visual styling (color, icon, etc.).
Sourcepub fn notify_info(&self, title: &str, body: &str)
pub fn notify_info(&self, title: &str, body: &str)
Convenience method to send an info notification
Sourcepub fn notify_success(&self, title: &str, body: &str)
pub fn notify_success(&self, title: &str, body: &str)
Convenience method to send a success notification
Sourcepub fn notify_warning(&self, title: &str, body: &str)
pub fn notify_warning(&self, title: &str, body: &str)
Convenience method to send a warning notification
Sourcepub fn notify_error(&self, title: &str, body: &str)
pub fn notify_error(&self, title: &str, body: &str)
Convenience method to send an error notification
Trait Implementations§
Source§impl Clone for PluginContext
impl Clone for PluginContext
Source§fn clone(&self) -> PluginContext
fn clone(&self) -> PluginContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more