pub struct TrayIcon { /* private fields */ }
Expand description
Tray icon struct and associated methods.
This type is reference-counted and the icon is removed when the last instance is dropped.
Implementations§
Source§impl TrayIcon
impl TrayIcon
Sourcepub fn new(attrs: TrayIconAttributes) -> Result<Self>
pub fn new(attrs: TrayIconAttributes) -> Result<Self>
Sourcepub fn with_id<I: Into<TrayIconId>>(
id: I,
attrs: TrayIconAttributes,
) -> Result<Self>
pub fn with_id<I: Into<TrayIconId>>( id: I, attrs: TrayIconAttributes, ) -> Result<Self>
Builds and adds a new tray icon to the system tray with the specified Id.
See TrayIcon::new
for more info.
Sourcepub fn id(&self) -> &TrayIconId
pub fn id(&self) -> &TrayIconId
Returns the id associated with this tray icon.
Sourcepub fn set_icon(&self, icon: Option<Icon>) -> Result<()>
pub fn set_icon(&self, icon: Option<Icon>) -> Result<()>
Set new tray icon. If None
is provided, it will remove the icon.
Set new tray menu.
§Platform-specific:
- Linux: once a menu is set it cannot be removed so
None
has no effect
Sourcepub fn set_title<S: AsRef<str>>(&self, title: Option<S>)
pub fn set_title<S: AsRef<str>>(&self, title: Option<S>)
Sets the tooltip for this tray icon.
§Platform-specific:
- Linux: The title will not be shown unless there is an icon as well. The title is useful for numerical and other frequently updated information. In general, it shouldn’t be shown unless a user requests it as it can take up a significant amount of space on the user’s panel. This may not be shown in all visualizations.
- Windows: Unsupported
Sourcepub fn set_visible(&self, visible: bool) -> Result<()>
pub fn set_visible(&self, visible: bool) -> Result<()>
Show or hide this tray icon
Sourcepub fn set_temp_dir_path<P: AsRef<Path>>(&self, path: Option<P>)
pub fn set_temp_dir_path<P: AsRef<Path>>(&self, path: Option<P>)
Sets the tray icon temp dir path. Linux only.
On Linux, we need to write the icon to the disk and usually it will
be $XDG_RUNTIME_DIR/tray-icon
or $TEMP/tray-icon
.
Sourcepub fn set_icon_as_template(&self, is_template: bool)
pub fn set_icon_as_template(&self, is_template: bool)
Set the current icon as a template. macOS only.
pub fn set_icon_with_as_template( &self, icon: Option<Icon>, is_template: bool, ) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TrayIcon
impl !RefUnwindSafe for TrayIcon
impl !Send for TrayIcon
impl !Sync for TrayIcon
impl Unpin for TrayIcon
impl !UnwindSafe for TrayIcon
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more