TrayIcon

external class TrayIcon : Resource(source)

Tray icon class and associated methods. This type constructor is private, instead, you should use the static method {@linkcode 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 {@linkcode TrayIcon.close}.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
external object Companion

Properties

Link copied to clipboard
external var id: String

The id associated with this tray icon.

Link copied to clipboard
external val rid: Double

Functions

Link copied to clipboard
external fun close(): Promise<Void>

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.

Link copied to clipboard
external fun setIcon(icon: ArrayBuffer?): Promise<Void>
external fun setIcon(icon: Uint8Array<*>?): Promise<Void>
external fun setIcon(icon: ReadonlyArray<Double>?): Promise<Void>
external fun setIcon(icon: String?): Promise<Void>
external fun setIcon(icon: Image?): Promise<Void>

Sets a new tray icon. If null is provided, it will remove the icon.

Link copied to clipboard
external fun setIconAsTemplate(asTemplate: Boolean): Promise<Void>

Sets the current icon as a template. macOS only

Link copied to clipboard
external fun setIconWithAsTemplate(icon: ArrayBuffer?, asTemplate: Boolean): Promise<Void>
external fun setIconWithAsTemplate(icon: Uint8Array<*>?, asTemplate: Boolean): Promise<Void>
external fun setIconWithAsTemplate(icon: ReadonlyArray<Double>?, asTemplate: Boolean): Promise<Void>
external fun setIconWithAsTemplate(icon: String?, asTemplate: Boolean): Promise<Void>
external fun setIconWithAsTemplate(icon: Image?, asTemplate: Boolean): Promise<Void>

Sets a new tray icon and template status atomically. macOS only.

Link copied to clipboard
external fun setMenu(menu: Menu?): Promise<Void>
external fun setMenu(menu: Submenu?): Promise<Void>

Sets a new tray menu.

Link copied to clipboard
external fun setMenuOnLeftClick(onLeft: Boolean): Promise<Void>

Disable or enable showing the tray menu on left click.

Link copied to clipboard
external fun setShowMenuOnLeftClick(onLeft: Boolean): Promise<Void>

Disable or enable showing the tray menu on left click.

Link copied to clipboard
external fun setTempDirPath(path: String?): Promise<Void>

Sets the tray icon temp dir path. Linux only.

Link copied to clipboard
external fun setTitle(title: String?): Promise<Void>

Sets the tooltip for this tray icon.

Link copied to clipboard
external fun setTooltip(tooltip: String?): Promise<Void>

Sets the tooltip for this tray icon.

Link copied to clipboard
external fun setVisible(visible: Boolean): Promise<Void>

Show or hide this tray icon.