Tray
Add rows to the system tray menu. Your rows appear in a submenu titled with your plugin's name, between Omniscio's own top rows and its recovery rows.
Availability: Both (backend ctx.tray / frontend Omniscio.tray) Required Permission: None
A click on one of your rows reaches your backend and your open pages without opening Omniscio's main window, so a row works while Omniscio sits in the tray.
TrayMenuItem
interface TrayMenuItem {
id: string // Letters, digits and dashes, up to 100 characters
label: string // Up to 50 characters
icon?: string // Accepted, not drawn yet
position?: 'top' | 'bottom' // Accepted, not used yet
}Methods
addMenuItem(item: TrayMenuItem): Promise<void>
Add a row. Adding a row with an id you already used replaces that row, so a backend can add its rows every time it starts. At most 10 rows per plugin; an eleventh new id is refused.
removeMenuItem(itemId: string): Promise<void>
Remove one row. Removing an id you never added does nothing.
updateMenuItem(itemId: string, fields: { label?: string; enabled?: boolean; checked?: boolean }): Promise<void>
Change a row's label, gray it out with enabled: false, or show a check mark. A row with checked set is drawn as a checkbox row.
onMenuItemClick(callback: (itemId: string) => void): () => void
Fires when the person clicks one of your rows. Returns the unsubscribe function. On the backend ctx.tray is optional, because an older Omniscio has none; check for it before you use it.
Lifetime
Your rows belong to your plugin. They disappear when it is disabled, and a click on a row that was removed while the menu was open is dropped.
Example (backend)
export async function onEnable(ctx: PluginContext) {
if (!ctx.tray) return
await ctx.tray.addMenuItem({ id: 'draw', label: 'Draw a card' })
ctx.tray.onMenuItemClick((itemId) => {
if (itemId === 'draw') void showDrawnCard(ctx)
})
}