Plugin

Trait Plugin 

Source
pub trait Plugin {
Show 16 methods // Provided methods fn window_open_animation( &mut self, _data: &AnimationFrameData, _window: &WindowInfo, ) -> Option<AnimationFrameResult> { ... } fn window_close_animation( &mut self, _data: &AnimationFrameData, _window: &WindowInfo, ) -> Option<AnimationFrameResult> { ... } fn window_move_animation( &mut self, _data: &AnimationFrameData, _window: &WindowInfo, ) -> Option<AnimationFrameResult> { ... } fn workspace_switch_animation( &mut self, _data: &AnimationFrameData, _workspace: &Workspace, ) -> Option<AnimationFrameResult> { ... } fn place_new_window(&mut self, _info: &WindowInfo) -> Option<Placement> { ... } fn window_deleted(&mut self, _info: &WindowInfo) { ... } fn window_focused(&mut self, _info: &WindowInfo) { ... } fn window_unfocused(&mut self, _info: &WindowInfo) { ... } fn workspace_created(&mut self, _workspace: &Workspace) { ... } fn workspace_removed(&mut self, _workspace: &Workspace) { ... } fn workspace_focused( &mut self, _previous_id: Option<u64>, _current: &Workspace, ) { ... } fn workspace_area_changed(&mut self, _workspace: &Workspace) { ... } fn window_workspace_changed( &mut self, _info: &WindowInfo, _workspace: &Workspace, ) { ... } fn configure(&mut self) -> Option<Configuration> { ... } fn handle_keyboard_input(&mut self, _event: KeyboardEvent) -> bool { ... } fn handle_pointer_event(&mut self, _event: PointerEvent) -> bool { ... }
}
Expand description

The core plugin trait.

Implement this trait to respond to compositor events. All methods have default no-op implementations, so you only need to override the hooks you care about.

Register your implementation with the [miracle_plugin!] macro:

#[derive(Default)]
struct MyPlugin;
impl Plugin for MyPlugin {}
miracle_plugin::miracle_plugin!(MyPlugin);

Provided Methods§

Source

fn window_open_animation( &mut self, _data: &AnimationFrameData, _window: &WindowInfo, ) -> Option<AnimationFrameResult>

Handles the window opening animation.

If None is returned, the animation is not handled by this plugin.

Source

fn window_close_animation( &mut self, _data: &AnimationFrameData, _window: &WindowInfo, ) -> Option<AnimationFrameResult>

Handles the window closing animation.

If None is returned, the animation is not handled by this plugin.

Source

fn window_move_animation( &mut self, _data: &AnimationFrameData, _window: &WindowInfo, ) -> Option<AnimationFrameResult>

Handles the window movement animation.

If None is returned, the animation is not handled by this plugin.

Source

fn workspace_switch_animation( &mut self, _data: &AnimationFrameData, _workspace: &Workspace, ) -> Option<AnimationFrameResult>

Handles the workspace switching animation.

If None is returned, the animation is not handled by this plugin.

Source

fn place_new_window(&mut self, _info: &WindowInfo) -> Option<Placement>

Dictate the placement of a newly opened window.

Return a Placement to override where and how the window is placed. Return None to let the compositor handle placement normally.

Source

fn window_deleted(&mut self, _info: &WindowInfo)

Called when a window is about to be deleted.

The window info is still valid at this point (the window has not yet been removed from the compositor).

Source

fn window_focused(&mut self, _info: &WindowInfo)

Called when a window gains focus.

Source

fn window_unfocused(&mut self, _info: &WindowInfo)

Called when a window loses focus.

Source

fn workspace_created(&mut self, _workspace: &Workspace)

Called when a workspace is created.

Source

fn workspace_removed(&mut self, _workspace: &Workspace)

Called when a workspace is removed.

Source

fn workspace_focused(&mut self, _previous_id: Option<u64>, _current: &Workspace)

Called when a workspace gains focus.

previous_id is the internal ID of the previously focused workspace, if any.

Source

fn workspace_area_changed(&mut self, _workspace: &Workspace)

Called when a workspace’s area (geometry) changes.

Source

fn window_workspace_changed( &mut self, _info: &WindowInfo, _workspace: &Workspace, )

Called when a window’s workspace has changed.

This fires whenever a window is moved to a different workspace, whether initiated by the user, a command, or a plugin.

Source

fn configure(&mut self) -> Option<Configuration>

Called on every config reload. Return a Configuration with the fields this plugin wants to override, or None to leave the compositor’s config unchanged.

Only fields that are Some(...) are applied; None fields are ignored. The plugins key cannot be set by plugins and is intentionally absent from Configuration.

Results from all loaded plugins are merged before being applied to the file-based configuration (last-loaded plugin wins on field conflicts).

Source

fn handle_keyboard_input(&mut self, _event: KeyboardEvent) -> bool

Handle a keyboard event.

If the plugin returns false, the event is propagated to the next handler in Miracle. If the plugin returns true, then the event is consumed by the plugin.

Source

fn handle_pointer_event(&mut self, _event: PointerEvent) -> bool

Handle a pointer event.

If the plugin returns false, the event is propagated to the next handler in Miracle. If the plugin returns true, then the event is consumed by the plugin.

Implementors§