Just discovered you can set a Java system property...
# compose-desktop
a
Just discovered you can set a Java system property
apple.awt.application.appearance=system
to get system-theme (dark/light) window title on macOS:
There’s also
Copy code
window.rootPane.putClientProperty("apple.awt.fullWindowContent", true)
window.rootPane.putClientProperty("apple.awt.transparentTitleBar", true)
to allow the app content to extend inside the title bar, but keeping the traffic light buttons.
🔥 3
a
whats the linux and windows equivalent of that flag?
a
I don’t think there are any.
😔 2
m
@Alexander Maryanovsky are these kind of system properties documented anywhere on the Kotlin side of things? I assume that Apple has documentation, but a KMP resource would be helpful to find those properties
a
They’re JVM/Swing properties, not KMP.
We could, and probably should, mention them in the Compose for Desktop tutorial.
a
Ya I would love some integrated support at some point in the future. For now I'm using this library, which works okay: https://github.com/Dansoftowner/jSystemThemeDetector
And I'm using that in conjunction with this to actually set the window theme to Light or Dark: https://github.com/weisJ/darklaf
Copy code
val osThemeDetector = OsThemeDetector.getDetector()
	if (osThemeDetector.isDark) {
		LafManager.install(DarculaTheme())
	} else {
		LafManager.install(IntelliJTheme())
	}