Is there a way on Mac to remove the traffic lights...
# compose-desktop
a
Is there a way on Mac to remove the traffic lights (close, minimize, maximize), but keep the window roundness and shadows? I tried setting the window to undecorated and even though it removes the buttons, it also removes the shadows and window corner radius
t
i just set both
undecorated
and
transparent
to true and wrap everything in a surface then i can control the shadow and radius throug the surface
Copy code
Window(
        onCloseRequest = ::exitApplication,
        undecorated = true,
        transparent = true
    ){
        Surface(
            modifier = Modifier
                .fillMaxSize()
                .padding(5.dp)
                .shadow(3.dp, RoundedCornerShape(10.dp)),
            color = MaterialTheme.colorScheme.surface,
            shape = RoundedCornerShape(10.dp),
            elevation = 40.dp
        ) {
            WindowDraggableArea {
            App()
            }
        }
    }
image.png
g
I'm doing the same thing as above. You'll have to make your own titlebar, but thats very easy with WindowDraggableArea.
a
that's not ideal because the shadows don't look the same. native windows change the shadow according to the window being focused or not.
g
So there's focus listeners for the window object that you could just change the shadow depth based on a state.
If you want to replicate 100% the original system window styling minus the titlebar then I remember coming across a way you could do it by interfacing with the macos WM via JNI. Let me see if I can find it again.
a
that's interesting. never used jni though. how do i call the objective c code from kotlin?