Tray
Tray item displayed in system notification area.
| Module | require("yue.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
Imageicon
Return
Traycreatewithtitle(title) macOS
Create a tray item with only title.
Parameters
stringtitle
Return
TrayMethods
remove()
Remove the tray item.
getbounds() macOS Windows
Return the position and size of the tray item.
Return
RectFsettitle(title) macOS Linux
Set title to be displayed aside item's icon.
Parameters
stringtitle
setimage(icon)
Set the icon of tray item.
Parameters
Imageicon
setpressedimage(image) macOS
Set the image to show when tray item is pressed.
Parameters
Imageimage
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
Menumenu
getmenu()
Return the menu attached.
Return
MenuEvents
onclick(self) macOS Windows
Emitted when the tray item is clicked.
Parameters
Trayself