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§
Sourcefn window_open_animation(
&mut self,
_data: &AnimationFrameData,
_window: &WindowInfo,
) -> Option<AnimationFrameResult>
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.
Sourcefn window_close_animation(
&mut self,
_data: &AnimationFrameData,
_window: &WindowInfo,
) -> Option<AnimationFrameResult>
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.
Sourcefn window_move_animation(
&mut self,
_data: &AnimationFrameData,
_window: &WindowInfo,
) -> Option<AnimationFrameResult>
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.
Sourcefn workspace_switch_animation(
&mut self,
_data: &AnimationFrameData,
_workspace: &Workspace,
) -> Option<AnimationFrameResult>
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.
Sourcefn place_new_window(&mut self, _info: &WindowInfo) -> Option<Placement>
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.
Sourcefn window_deleted(&mut self, _info: &WindowInfo)
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).
Sourcefn window_focused(&mut self, _info: &WindowInfo)
fn window_focused(&mut self, _info: &WindowInfo)
Called when a window gains focus.
Sourcefn window_unfocused(&mut self, _info: &WindowInfo)
fn window_unfocused(&mut self, _info: &WindowInfo)
Called when a window loses focus.
Sourcefn workspace_created(&mut self, _workspace: &Workspace)
fn workspace_created(&mut self, _workspace: &Workspace)
Called when a workspace is created.
Sourcefn workspace_removed(&mut self, _workspace: &Workspace)
fn workspace_removed(&mut self, _workspace: &Workspace)
Called when a workspace is removed.
Sourcefn workspace_focused(&mut self, _previous_id: Option<u64>, _current: &Workspace)
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.
Sourcefn workspace_area_changed(&mut self, _workspace: &Workspace)
fn workspace_area_changed(&mut self, _workspace: &Workspace)
Called when a workspace’s area (geometry) changes.
Sourcefn window_workspace_changed(
&mut self,
_info: &WindowInfo,
_workspace: &Workspace,
)
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.
Sourcefn configure(&mut self) -> Option<Configuration>
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).
Sourcefn handle_keyboard_input(&mut self, _event: KeyboardEvent) -> bool
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.
Sourcefn handle_pointer_event(&mut self, _event: PointerEvent) -> bool
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.