콘텐츠로 이동

TrayIcon

이 콘텐츠는 아직 번역되지 않았습니다.

Module @netwiv/api/tray · Kind Constant

import { TrayIcon } from '@netwiv/api/tray';
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.

id: string

The id associated with this tray icon.

rid: number
setIcon(icon: string | number[] | Image | ArrayBuffer | Uint8Array<ArrayBufferLike> | null): Promise<void>

Sets 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"] }
setIconAsTemplate(asTemplate: boolean): Promise<void>

Sets the current icon as a template. macOS only

setIconWithAsTemplate(icon: string | number[] | Image | ArrayBuffer | Uint8Array<ArrayBufferLike> | null, asTemplate: boolean): Promise<void>

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

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"] }
setMenu(menu: Menu | Submenu | null): Promise<void>

Sets a new tray menu.

  • Linux: once a menu is set it cannot be removed so null has no effect
setMenuOnLeftClick(onLeft: boolean): Promise<void>

Disable or enable showing the tray menu on left click.

  • Linux: Unsupported.

Deprecated use {@linkcode TrayIcon.setShowMenuOnLeftClick} instead.

setShowMenuOnLeftClick(onLeft: boolean): Promise<void>

Disable or enable showing the tray menu on left click.

  • Linux: Unsupported.
setTempDirPath(path: string | null): Promise<void>

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.

setTitle(title: string | null): Promise<void>

Sets the tooltip for this tray icon.

  • 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
setTooltip(tooltip: string | null): Promise<void>

Sets the tooltip for this tray icon.

  • Linux: Unsupported
setVisible(visible: boolean): Promise<void>

Show or hide this tray icon.


Descriptions come from the pinned @tauri-apps/api@2.11.1 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.