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
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