Tray
Registers a system-tray icon for the lifetime of this composition.
The icon shows image, with tooltip as its hover text where one is given. Activating the icon (the platform's primary click) runs onAction. Requesting its popup (the platform popup gesture) opens a menu built from menu, the same menu tree used by a menu bar or context menu - Menu, MenuItem, CheckBoxMenuItem, RadioButtonMenuItem, MenuSeparator. The menu reads composition state, so its items reflect the current state each time it opens, and an item's callback updates state like any other composable callback.
The icon is added when this enters the composition and removed when it leaves.
A tray icon requires a platform system tray; java.awt.SystemTray.isSupported is the caller's probe for one. Where the platform has none, this composable registers no icon and prints a warning to standard error, leaving an application whose only content is a Tray free to end.
Call this inside an application { } content block so the menu shares the application composition's scope and androidx.compose.runtime.CompositionLocals.
Parameters
the icon image shown in the tray.
callback run when the icon is activated.
the hover text for the icon, or null for an icon with none.
whether image is scaled to the size the platform's tray allocates, rather than painted at its own size.
the composable menu tree opened on the popup gesture.