pub struct TrayIconSpec {
pub id: TrayIconId,
pub tooltip: String,
pub menu: Option<MenuId>,
pub visible: bool,
pub icon_bytes: Option<Vec<u8>>,
}Expand description
Specification for a system tray icon.
Fields§
§id: TrayIconIdStable identifier for the tray icon.
tooltip: StringHover tooltip text.
Optional context menu bound to the tray icon.
visible: boolWhether the tray icon is visible in the status area.
icon_bytes: Option<Vec<u8>>Optional raw icon pixels.
The shared encoding contract is a square straight-alpha RGBA
raster: side * side * 4 bytes in row-major order. A lane whose
native image loader recognises container formats may additionally
accept an encoded image (Cocoa decodes PNG/TIFF/ICNS/JPEG/GIF/BMP and
the ISO base media family); a payload that fits neither shape is
refused with a typed error. None leaves the icon on the platform
default image.
Implementations§
Source§impl TrayIconSpec
impl TrayIconSpec
Sourcepub fn new(id: TrayIconId, tooltip: impl Into<String>) -> Self
pub fn new(id: TrayIconId, tooltip: impl Into<String>) -> Self
Creates a visible tray icon specification with default settings.
Sets the context menu for the tray icon.
Sourcepub fn with_visible(self, visible: bool) -> Self
pub fn with_visible(self, visible: bool) -> Self
Sets whether the tray icon is visible.
Sourcepub fn with_icon_bytes(self, icon_bytes: Vec<u8>) -> Self
pub fn with_icon_bytes(self, icon_bytes: Vec<u8>) -> Self
Sets the raw icon pixels for the tray icon.
See TrayIconSpec::icon_bytes for the shared encoding contract
(square straight-alpha RGBA, or an encoded container the lane’s loader
recognises).