One question. It there a way to create a top bar i...
# compose-desktop
l
One question. It there a way to create a top bar in compose that has the mac buttons integrated to it? Like Slack:
r
There's no built-in support. Unfortunately windowing in Compose Desktop is pretty bare-bones. It's achievable though, just requires work. To my knowledge there's no way to do this in Swing either, so you'll have to use native APIs. You can use JNA to interact with the native APIs and move the buttons. Here's the method you're looking for which gets a handle to the window button -- then you should be able to adjust button's frame.origin to move it where you want. https://developer.apple.com/documentation/appkit/nswindow/standardwindowbutton(_:)?language=objc You'll need to accompany this with making the titlebar transparent, which should be possible via Swing.
l
Wow, I thought it would be something much simpler. But hey, that's super nice! Thanks for sharing Rob
I don't think a deep dive into those libraries just to make top bar look cool is a good use of my time at the moment... but when I take a deeper a look into this I'll let you know what I've find. Again, thanks for sharing!
u
You can do it with Jewel
🦜 1
l
I'll take a look Elie, thanks! By the way... what is Jewel?
u
The best library for compose desktop 🤩
l
=O
You're right, this is amazing. Okay, nice! I'll try to use Jewel to make a nice top bar. Thanks! Helped a ton!
u
I love your project, it looks so good, I can't wait for it to come out so I can write my docs.
Don't forget linux users like me please
l
Hey hey, thanks! Yours is super cool too =D. I won't forget Linux users for sure! I just need to get a computer with Linux to test it there. When it is deployed, I'll let you know 😄
👍 1
a
Use
Copy code
fun main() = application {
    Window(
        onCloseRequest = ::exitApplication,
        title = ""
    ) {
        Box(Modifier.fillMaxSize().background(Color.Red))
        LaunchedEffect(window.rootPane) {
            with(window.rootPane) {
                putClientProperty("apple.awt.transparentTitleBar", true)
                putClientProperty("apple.awt.fullWindowContent", true)
            }
        }
    }
}
l
Looks promising. I'll try it and let you know Alexander
mind blown Totally worked!
I just removed the
.background(Color.Red)
haha
Thanks Alexander, you're a hero!
a
I actually just asked Claude.ai how to do it (although I already knew it was possible; just didn’t remember the magic strings).
👍 2