Skip to main content

overwolf.os.tray API

Use this API for windows system tray related functionalities.

Methods Reference

Events Reference

Types Reference

setMenu(menu, callback)

Version added: 0.131

Permissions required: Tray

Create a tray icon for the calling extension with the supplied context menu object.

ParameterTypeDescription
menuExtensionTrayMenu objectThe menu object
callback(Result) => voidReturns with the result

Usage Example

const trayMenu = {
"menu_items": [{
"label": "View main window",
"id": "view_window"
}
]
}

overwolf.os.tray.setMenu(trayMenu, (res) => {
console.log("setMenu -> res", res)
});

Notes

  • A launcher_icon must be set in the manifest.
  • Calling setMenu() is mandatory to get a tray icon.

changeIcon(path, callback)

Version added: 0.208

Requires an app menu

An app's tray icon cannot be changed before it has one. You must call overwolf.os.tray.setMenu() before you can use this method!

Changes the tray icon for the app temporarily.

ParameterTypeDescription
pathstringPath for the new tray icon, relative to the app's install directory.
callback(Result) => voidReturns with the result of the operation

changeIcon(space, path, callback)

Version added: 0.208

Requires an app menu

An app's tray icon cannot be changed before it has one. You must call overwolf.os.tray.setMenu() before you can use this method!

Changes the tray icon for the app temporarily, using a StorageSpace enum.

ParameterTypeDescription
spaceStorageSpace enumSpace to look for the new icon.
pathstringPath for the new tray icon, relative to space.
callback(Result) => voidReturns with the result of the operation

restoreIcon(callback)

Version added: 0.208

Requires an app menu

An app's tray icon cannot be changed before it has one. You must call overwolf.os.tray.setMenu() before you can use this method!

Reverts the temporariy app tray icon back to the manifest-defined tray_icon.

ParameterTypeDescription
callback(Result) => voidReturns with the result of the operation

destroy()

Version added: 0.173

Permissions required: Tray

Destroys the tray icon immediately.

ParameterTypeDescription
nonenoneno params

ExtensionTrayMenu Object

A container object for a menu.

ParameterTypeDescription
menu_itemsmenu_item[]array of menu items

An example for a menu with sub items:


{
"menu_items": [{
"label": "View main window",
"id": "view_window"
},
{
"label": "More...",
"enabled": true,
"sub_items": [{
"label": "Version 1.0.0",
"id": "more_version",
"enabled": false
}]
},
{
"label": "-"
},
{
"label": "Visit website",
"id": "more_website"
}

]
}

A container object for a menu item.

ParameterTypeDescription
idstringmust be set for items without "sub_items". (Separators and items with sub_items don't need ids)
labelstringin order to create a separator, use the label "-"
enabledbooleanset to true by default
sub_itemsmenu_item[]you can nest an array of menu items under this item

An example of a menu objects with sub items:

{
"label": "More...",
"enabled": true,
"sub_items": [{
"label": "Version 1.0.0",
"id": "more_version",
"enabled": false
}]
}

onMenuItemClicked

Version added: 0.131

Fired when an item from the tray icon’s context menu is selected, with the following structure: onMenuItemClickedEvent Object

Event data example

{ "item": "id" }

onTrayIconClicked

Version added: 0.131

Fired when the tray icon is left clicked.

onTrayIconDoubleClicked

Version added: 0.131

Fired when the tray icon is double clicked.

onMenuItemClickedEvent Object

ParameterTypeDescription
itemstring