Max
12/02/2024, 11:30 AMtitle bar
on MacOS and Windows for my Compose Desktop window?
Meaning:
• 🌙 dark mode if system is in dark mode
• 📏 Double the height, like default macOS title bar
For Comparison the Slack app title bar on top, Compose Desktop below.Michael Paus
12/02/2024, 1:07 PMval isMac = System.getProperty("os.name").startsWith("Mac")
if ( isMac ) {
System.setProperty("apple.awt.application.appearance", "system")
}
in your desktop main method already?Max
12/02/2024, 1:16 PMSystem.setProperty("apple.awt.application.appearance", "system")
), the window didn’t change however.Michael Paus
12/02/2024, 1:32 PMMax
12/02/2024, 1:37 PMfun main() = application {
System.setProperty("apple.awt.application.appearance", "system")
Window(
onCloseRequest = ::exitApplication,
title = "KMP-Template-Project",
) {
Box(
modifier = Modifier
.width(400.dp)
.height(300.dp)
)
}
}
Could you maybe share your entrance main.kt
file?Michael Paus
12/02/2024, 1:39 PMfun main(args: Array<String>) {
val isMac = System.getProperty("os.name").startsWith("Mac")
if ( isMac ) {
System.setProperty("apple.awt.application.appearance", "system")
}
application {
...
Michael Paus
12/02/2024, 1:40 PMMax
12/02/2024, 1:41 PMSystem.setProperty("apple.awt.application.appearance", "system")
Has to be outside the application{}
tag, then it works👍 cool, looks better already. Thanks!
Do you know if we can also increase the size of the toolbar? I will later check if i find more useful flags inside apple.awt.application.appearance
Michael Paus
12/02/2024, 1:42 PMMax
12/02/2024, 1:51 PMMax
12/02/2024, 1:51 PMwindow.rootPane.putClientProperty("apple.awt.fullWindowContent", true)
window.rootPane.putClientProperty("apple.awt.transparentTitleBar", true)
For full native feelDaniel Pitts
12/02/2024, 4:58 PMfun main() {
System.setProperty("apple.awt.application.appearance", "system")
System.setProperty("skiko.rendering.laf.global", "true")
System.setProperty("skiko.rendering.useScreenMenuBar", "true")
System.setProperty("skiko.linux.autodpi", "true")
application {
Window(
onCloseRequest = ::exitApplication,
title = "My App",
) {
App()
}
}
}
I don't think you need to check if it is apple beefore setting the properties btw. They are just ignored if not applicable.Michael Paus
12/02/2024, 6:06 PMDaniel Pitts
12/02/2024, 6:09 PMMichael Paus
12/02/2024, 6:10 PMDaniel Pitts
12/02/2024, 7:54 PMDaniel Pitts
12/02/2024, 8:07 PMandroidx.compose.ui.configureSwingGlobalsForCompose
for the same effect.