mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-17 15:32:01 +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 {
|
compose.desktop {
|
||||||
application {
|
application {
|
||||||
mainClass = "com.nuvio.app.DesktopAppKt"
|
mainClass = "com.nuvio.app.DesktopAppKt"
|
||||||
|
nativeDistributions {
|
||||||
|
macOS {
|
||||||
|
infoPlist {
|
||||||
|
extraKeysRawXml = """
|
||||||
|
<key>NSRequiresAquaSystemAppearance</key>
|
||||||
|
<false/>
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,33 @@
|
||||||
package com.nuvio.app
|
package com.nuvio.app
|
||||||
|
|
||||||
|
import androidx.compose.runtime.DisposableEffect
|
||||||
import androidx.compose.ui.window.Window
|
import androidx.compose.ui.window.Window
|
||||||
import androidx.compose.ui.window.application
|
import androidx.compose.ui.window.application
|
||||||
|
import java.awt.Color as AwtColor
|
||||||
|
|
||||||
fun main() = application {
|
private val DesktopWindowBackground = AwtColor(0x0D, 0x0D, 0x0D)
|
||||||
Window(
|
|
||||||
onCloseRequest = ::exitApplication,
|
private fun configureMacOsNativeAppearance() {
|
||||||
title = "Nuvio",
|
val osName = System.getProperty("os.name")?.lowercase() ?: return
|
||||||
) {
|
if (!osName.contains("mac")) return
|
||||||
App()
|
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