import androidx.compose.runtime.Composable
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.res.ResourceLoader
import androidx.compose.ui.res.loadImageBitmap
import androidx.compose.ui.window.ApplicationScope
import androidx.compose.ui.window.Tray

object TrayIcon : Painter() {
    override val intrinsicSize = Size(256f, 256f)
    override fun DrawScope.onDraw() {
        drawImage(
            WindowProperty.icon
        )
    }
}

@Composable
fun ApplicationScope.AppTray(onAction: () -> Unit = {}) = Tray(
    TrayIcon,
    tooltip = WindowProperty.title,
    onAction = onAction,
    menu = {

        Item("Exit", onClick = ::exitApplication)
    },
)