pub struct TrayIconBuilder<R: Runtime> { /* private fields */ }Available on
desktop and crate feature tray-icon only.Expand description
TrayIcon builder struct and associated methods.
Implementations§
Source§impl<R: Runtime> TrayIconBuilder<R>
impl<R: Runtime> TrayIconBuilder<R>
Sourcepub fn with_id<I: Into<TrayIconId>>(id: I) -> Self
pub fn with_id<I: Into<TrayIconId>>(id: I) -> Self
Set the a menu for this tray icon.
§Platform-specific:
- Linux: once a menu is set, it cannot be removed or replaced but you can change its content.
Sourcepub fn title<S: AsRef<str>>(self, title: S) -> Self
pub fn title<S: AsRef<str>>(self, title: S) -> Self
Set the tray icon title.
§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 temp_dir_path<P: AsRef<Path>>(self, s: P) -> Self
pub fn temp_dir_path<P: AsRef<Path>>(self, s: P) -> Self
Set 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 icon_as_template(self, is_template: bool) -> Self
pub fn icon_as_template(self, is_template: bool) -> Self
Use the icon as a template. macOS only.
👎Deprecated since 2.2.0: Use TrayIconBuilder::show_menu_on_left_click instead.
TrayIconBuilder::show_menu_on_left_click instead.Whether to show the tray menu on left click or not, default is true.
§Platform-specific:
- Linux: Unsupported.
Whether to show the tray menu on left click or not, default is true.
§Platform-specific:
- Linux: Unsupported.
Set a handler for menu events.
Note that this handler is called for any menu event, whether it is coming from this window, another window or from the tray icon menu.
Sourcepub fn on_tray_icon_event<F: Fn(&TrayIcon<R>, TrayIconEvent) + Sync + Send + 'static>(
self,
f: F,
) -> Self
pub fn on_tray_icon_event<F: Fn(&TrayIcon<R>, TrayIconEvent) + Sync + Send + 'static>( self, f: F, ) -> Self
Set a handler for this tray icon events.
Sourcepub fn id(&self) -> &TrayIconId
pub fn id(&self) -> &TrayIconId
Access the unique id that will be assigned to the tray icon this builder will create.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for TrayIconBuilder<R>
impl<R> !RefUnwindSafe for TrayIconBuilder<R>
impl<R> !Send for TrayIconBuilder<R>
impl<R> !Sync for TrayIconBuilder<R>
impl<R> Unpin for TrayIconBuilder<R>
impl<R> !UnwindSafe for TrayIconBuilder<R>
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