Tray
Tray item displayed in system notification area.
Module | require("gui") |
Type | Class |
Platform limitations:
- On Linux tray items are displayed as app indicators.
- On Linux there is no fallback when app indicators are not supported.
- On Linux app indicator can only show when it has menu attached.
- On Windows you have to explicitly remove the tray item on exit, otherwise a zombie icon would be left.
Class methods
createWithImage(icon)
Create a tray item with icon
.
Parameters
Image
icon
Return
Tray
macOS
createWithTitle(title)Create a tray item with only title
.
Parameters
String
title
Return
Tray
Methods
remove()
Remove the tray item.
macOS Windows
getBounds()Return the position and size of the tray item.
Return
RectF
macOS Linux
setTitle(title)Set title to be displayed aside item's icon.
Parameters
String
title
setImage(icon)
Set the icon
of tray item.
Parameters
Image
icon
macOS
setPressedImage(image)Set the image
to show when tray item is pressed.
Parameters
Image
image
setMenu(menu)
Set the menu attached with the tray item.
On most platforms the menu will show when clicking on the icon, while on Windows the menu will only show when when right-clicking on the icon.
Parameters
Menu
menu
getMenu()
Return the menu attached.
Return
Menu
Events
macOS Windows
onClick(self)Emitted when the tray item is clicked.
Parameters
Tray
self