Destroys and cleans up this resource from memory. You should not call any method on this object anymore and should drop any reference to it.
StaticgetStaticremoveRemoves a tray icon using the provided id from tauri's internal state.
Note that this may cause the tray icon to disappear if it wasn't cloned somewhere else or referenced by JS.
StaticnewCreates a new TrayIcon
Menu is enough.Optionaloptions: TrayIconOptionsSets a new tray icon. If null is provided, it will remove the icon.
Note that you may need the image-ico or image-png Cargo features to use this API.
To enable it, change your Cargo.toml file:
[dependencies]
tauri = { version = "...", features = ["...", "image-png"] }
Sets the tooltip for this tray icon.
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.
use TrayIcon.setShowMenuOnLeftClick instead.
Tray icon class and associated methods. This type constructor is private, instead, you should use the static method
TrayIcon.new.Warning
Unlike Rust, javascript does not have any way to run cleanup code when an object is being removed by garbage collection, but this tray icon will be cleaned up when the tauri app exists, however if you want to cleanup this object early, you need to call
TrayIcon.close.Example