pub struct AppLauncher { /* private fields */ }Expand description
Application launcher with search, grid display, and keyboard navigation.
Implementations§
Source§impl AppLauncher
impl AppLauncher
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new application launcher pre-populated with default applications.
Sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Returns true if the launcher is currently visible.
Sourcepub fn set_overlay_rect(
&mut self,
x: usize,
y: usize,
width: usize,
height: usize,
)
pub fn set_overlay_rect( &mut self, x: usize, y: usize, width: usize, height: usize, )
Set the overlay position and dimensions (called when screen size is known).
Sourcepub fn register_app(&mut self, entry: AppEntry)
pub fn register_app(&mut self, entry: AppEntry)
Register a new application entry with the launcher.
Sourcepub fn unregister_app(&mut self, exec_path: &str)
pub fn unregister_app(&mut self, exec_path: &str)
Remove an application by exec path.
Sourcepub fn handle_key(&mut self, key: u8) -> Option<LauncherAction>
pub fn handle_key(&mut self, key: u8) -> Option<LauncherAction>
Handle a keyboard input event.
Returns an optional LauncherAction indicating what the caller should
do (launch an app, hide the launcher, or nothing).
Key mappings:
- Enter (0x0A or 0x0D): launch the selected application
- Escape (0x1B): hide the launcher
- Backspace (0x08): delete last character from search query
- Arrow Up (0x80): move selection up one row
- Arrow Down (0x81): move selection down one row
- Arrow Left (0x82): move selection left one column
- Arrow Right (0x83): move selection right one column
- Printable ASCII (0x20..=0x7E): append to search query, filter entries
Sourcepub fn handle_click(&mut self, x: usize, y: usize) -> Option<LauncherAction>
pub fn handle_click(&mut self, x: usize, y: usize) -> Option<LauncherAction>
Handle a mouse click at absolute screen coordinates (x, y).
Returns Some(LauncherAction::Launch(...)) if an app entry was clicked,
or None if the click was outside the grid area (but still inside the
overlay).
Sourcepub fn filter_entries(&mut self)
pub fn filter_entries(&mut self)
Filter entries by the current search_query.
Performs a case-insensitive substring match on the application name. If the query is empty, all entries are shown.
Sourcepub fn selected_entry(&self) -> Option<&AppEntry>
pub fn selected_entry(&self) -> Option<&AppEntry>
Get a reference to the currently selected application entry.
Sourcepub fn visible_entries(&self) -> &[usize]
pub fn visible_entries(&self) -> &[usize]
Get the indices of visible (filtered) entries.
Sourcepub fn filtered_count(&self) -> usize
pub fn filtered_count(&self) -> usize
Get the total number of filtered entries.
Sourcepub fn render_to_buffer(
&self,
buffer: &mut [u32],
buf_width: usize,
buf_height: usize,
)
pub fn render_to_buffer( &self, buffer: &mut [u32], buf_width: usize, buf_height: usize, )
Render the launcher overlay into a u32 BGRA pixel buffer.
The buffer dimensions must be buf_width * buf_height elements.
The launcher is drawn at its configured overlay position.