mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 23:12:12 +00:00
feat(macos):add background color for desktop app
This commit is contained in:
parent
da1b83c3b7
commit
462b81f8ad
2 changed files with 36 additions and 6 deletions
|
|
@ -281,6 +281,16 @@ dependencies {
|
|||
compose.desktop {
|
||||
application {
|
||||
mainClass = "com.nuvio.app.DesktopAppKt"
|
||||
nativeDistributions {
|
||||
macOS {
|
||||
infoPlist {
|
||||
extraKeysRawXml = """
|
||||
<key>NSRequiresAquaSystemAppearance</key>
|
||||
<false/>
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,33 @@
|
|||
package com.nuvio.app
|
||||
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.ui.window.Window
|
||||
import androidx.compose.ui.window.application
|
||||
import java.awt.Color as AwtColor
|
||||
|
||||
fun main() = application {
|
||||
Window(
|
||||
onCloseRequest = ::exitApplication,
|
||||
title = "Nuvio",
|
||||
) {
|
||||
App()
|
||||
private val DesktopWindowBackground = AwtColor(0x0D, 0x0D, 0x0D)
|
||||
|
||||
private fun configureMacOsNativeAppearance() {
|
||||
val osName = System.getProperty("os.name")?.lowercase() ?: return
|
||||
if (!osName.contains("mac")) return
|
||||
System.setProperty("apple.awt.application.appearance", "NSAppearanceNameDarkAqua")
|
||||
}
|
||||
|
||||
fun main() {
|
||||
configureMacOsNativeAppearance()
|
||||
application {
|
||||
Window(
|
||||
onCloseRequest = ::exitApplication,
|
||||
title = "Nuvio",
|
||||
) {
|
||||
DisposableEffect(window) {
|
||||
window.background = DesktopWindowBackground
|
||||
window.contentPane.background = DesktopWindowBackground
|
||||
window.rootPane.background = DesktopWindowBackground
|
||||
onDispose { }
|
||||
}
|
||||
|
||||
App()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue