Open s949492225 opened 1 year ago
I guess you want to use the tray (see Menu, tray, notifications) with a Dialog
? Sample implementation would be:
fun main() = application {
var count by remember { mutableStateOf(0) }
var isOpen by remember { mutableStateOf(false) }
val trayState = rememberTrayState()
Tray(
state = trayState,
icon = TrayIcon,
onAction = { isOpen = true },
)
if (isOpen) {
Dialog(
onCloseRequest = { isOpen = false },
) {
this.window.size
Box(
modifier = Modifier.size(256.dp),
contentAlignment = Alignment.Center
) {
Text(text = "Value: $count")
}
}
}
}
object TrayIcon : Painter() {
override val intrinsicSize = Size(256f, 256f)
override fun DrawScope.onDraw() {
drawOval(Color(0xFFFFA500))
}
}
Is there any way to get the tray's position and width on the screen?
As far as I know there is no way to do that, not with the current version of Compose, and I don't think it will be easy to support or work around this limitation. But correct me if I'm wrong.
That Dialog trick did not work for me, the icon is still visible in the dock, any solution?
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
May I ask how to achieve the effect in the following picture? Display the icon in the title bar, click the icon to display a window below the icon, and do not display the application in the dock of mac.
It is said that jetbrain toolbox is written in compose desktop, and the interaction used is also in the form mentioned above. preferably a simple demo, thank you