Defined in: tray.ts:94
Class-based tray API — a port of @tauri-apps/api/tray TrayIcon.
G5/B9: the host keeps up to MAX_TRAYS NSStatusItems; the no-id methods
target the legacy default instance, id-bearing ones address others.
readonlyid:string
Defined in: tray.ts:95
destroy():
Promise<void>
Defined in: tray.ts:198
Removes the tray item.
Promise<void>
onClick(
handler):Promise<() =>Promise<void>>
Defined in: tray.ts:193
Listens for clicks (only when no menu is attached).
() => void
Promise<() => Promise<void>>
onDetailedClick(
handler):Promise<() =>Promise<void>>
Defined in: tray.ts:146
Rich click stream (G5/B9): handler receives attribution when the host can
provide it — button/clickCount/double/screen coords; legacy onClick
keeps its zero-arg shape.
(e) => void
Promise<() => Promise<void>>
setIcon(
icon):Promise<void>
Defined in: tray.ts:170
Promise<void>
setIconAsTemplate(
asTemplate):Promise<void>
Defined in: tray.ts:188
Marks the current icon as a template image — macOS renders it adaptively in light/dark menu bars (monochrome alpha-only art).
boolean
Promise<void>
setMenu(
menuId):Promise<void>
Defined in: tray.ts:175
Attaches a registered menu (left-click shows it on macOS).
string
Promise<void>
setShowMenuOnLeftClick(
on):Promise<void>
Defined in: tray.ts:134
Toggles left-click menu attachment for the given instance.
boolean
Promise<void>
setTitle(
title):Promise<void>
Defined in: tray.ts:162
string
Promise<void>
setTooltip(
tooltip):Promise<void>
Defined in: tray.ts:166
string
Promise<void>
setVisible(
visible):Promise<void>
Defined in: tray.ts:180
Shows/hides the tray item.
boolean
Promise<void>
staticcreate(options?):Promise<TrayIcon>
Defined in: tray.ts:102
Creates the native tray item (title/tooltip optional; id for extra instances).
string
boolean
string
string
Promise<TrayIcon>
staticgetById(id):Promise<boolean>
Defined in: tray.ts:124
Whether an instance with this id exists (upstream TrayIcon.getById).
string
Promise<boolean>
staticremoveById(id):Promise<void>
Defined in: tray.ts:129
Removes an instance by id (upstream TrayIcon.removeById).
string
Promise<void>
Defined in: tray.ts:9
title:
string
Defined in: tray.ts:10
optionaltooltip?:string
Defined in: tray.ts:11
consttray:object
Defined in: tray.ts:79
create: (
options) =>Promise<void> =createTray
Creates a system tray item with a text title.
Promise<void>
destroy: () =>
Promise<void> =destroyTray
Promise<void>
onClick: (
handler) =>Promise<() =>Promise<void>> =onTrayClick
Listens to tray clicks.
() => void
Promise<() => Promise<void>>
setIcon: (
icon) =>Promise<void> =setTrayIcon
Sets the tray icon from a file path, a registered Image, or raw bytes
(transformImage normalizes the argument).
Promise<void>
setMenu: (
menuId) =>Promise<void> =setTrayMenu
Attaches a registered menu to the tray (left-click shows it on macOS, per NSStatusItem convention — the standard place for Quit/Preferences).
string
Promise<void>
setTitle: (
title) =>Promise<void> =setTrayTitle
string
Promise<void>
setTooltip: (
tooltip) =>Promise<void> =setTrayTooltip
string
Promise<void>
createTray(
options):Promise<void>
Defined in: tray.ts:15
Creates a system tray item with a text title.
Promise<void>
destroyTray():
Promise<void>
Defined in: tray.ts:42
Promise<void>
getTrayById(
id):Promise<boolean>
Defined in: tray.ts:62
Whether a tray instance with this id exists.
string
Promise<boolean>
onTrayClick(
handler):Promise<() =>Promise<void>>
Defined in: tray.ts:55
Listens to tray clicks.
() => void
Promise<() => Promise<void>>
removeTrayById(
id):Promise<void>
Defined in: tray.ts:67
Removes an extra tray instance by id.
string
Promise<void>
setShowMenuOnLeftClick(
on,id?):Promise<void>
Defined in: tray.ts:72
Toggles left-click menu behavior for an instance (default = legacy one).
boolean
string
Promise<void>
setTrayIcon(
icon):Promise<void>
Defined in: tray.ts:34
Sets the tray icon from a file path, a registered Image, or raw bytes
(transformImage normalizes the argument).
Promise<void>
setTrayMenu(
menuId):Promise<void>
Defined in: tray.ts:50
Attaches a registered menu to the tray (left-click shows it on macOS, per NSStatusItem convention — the standard place for Quit/Preferences).
string
Promise<void>
setTrayTitle(
title):Promise<void>
Defined in: tray.ts:22
string
Promise<void>
setTrayTooltip(
tooltip):Promise<void>
Defined in: tray.ts:26
string
Promise<void>