pub struct SystemTray { /* private fields */ }Expand description
System tray managing a collection of status indicator items.
Implementations§
Source§impl SystemTray
impl SystemTray
Sourcepub fn add_item(&mut self, item: SysTrayItem)
pub fn add_item(&mut self, item: SysTrayItem)
Add a new item to the tray.
Sourcepub fn remove_item(&mut self, item_type: SysTrayItemType)
pub fn remove_item(&mut self, item_type: SysTrayItemType)
Remove the first item matching the given type.
Sourcepub fn update_clock(
&mut self,
hours: u8,
minutes: u8,
_seconds: u8,
month: u8,
day: u8,
)
pub fn update_clock( &mut self, hours: u8, minutes: u8, _seconds: u8, month: u8, day: u8, )
Update the clock display with the given time and date.
Sourcepub fn update_cpu(&mut self, usage_percent: u8)
pub fn update_cpu(&mut self, usage_percent: u8)
Update the CPU usage display.
Sourcepub fn update_memory(&mut self, used_mb: u32, total_mb: u32)
pub fn update_memory(&mut self, used_mb: u32, total_mb: u32)
Update the memory usage display.
Sourcepub fn update_network(&mut self, is_up: bool)
pub fn update_network(&mut self, is_up: bool)
Update the network status display.
Sourcepub fn update_volume(&mut self, volume_percent: u8)
pub fn update_volume(&mut self, volume_percent: u8)
Update the volume display (0-100).
Sourcepub fn update_battery(&mut self, label_str: &str)
pub fn update_battery(&mut self, label_str: &str)
Update the battery/power status display.
Sourcepub fn total_width(&self) -> usize
pub fn total_width(&self) -> usize
Total pixel width of all visible tray items plus inter-item padding.
Sourcepub fn render_to_buffer(
&self,
buffer: &mut [u32],
buf_width: usize,
x_start: usize,
y_start: usize,
)
pub fn render_to_buffer( &self, buffer: &mut [u32], buf_width: usize, x_start: usize, y_start: usize, )
Render the system tray into a u32 (BGRA) pixel buffer.
Items are drawn starting at (x_start, y_start) and proceed
left-to-right. Separators are drawn between items.
Sourcepub fn handle_click(&self, x: usize, _y: usize) -> Option<SysTrayItemType>
pub fn handle_click(&self, x: usize, _y: usize) -> Option<SysTrayItemType>
Determine which tray item (if any) was clicked at position (x, y).
Coordinates are relative to the tray area origin (the same coordinate
system used for render_to_buffer). Returns None if the click is
outside any item.