Skip to content

Commit

Permalink
Set the app name on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
romainguy committed May 17, 2024
1 parent 4a64ab0 commit 6364e88
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 38 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ compose.desktop {

targetFormats(TargetFormat.Dmg)

packageName = "Kotlin Explorer"
packageVersion = "1.1.0"
packageName = "Kotlin Explorer"
description = "Kotlin Explorer"
vendor = "Romain Guy"
licenseFile = rootProject.file("LICENSE")

macOS {
dockName = "Kotlin Explorer"
bundleID = "dev.romainguy.kotlin.explorer"
iconFile = file("icons/jewel.icns")
}
}
}
Expand Down
78 changes: 41 additions & 37 deletions src/jvmMain/kotlin/dev/romainguy/kotlin/explorer/KotlinExplorer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -551,50 +551,54 @@ private fun RSyntaxTextArea.updateStyle(explorerState: ExplorerState) {
}

@OptIn(ExperimentalJewelApi::class)
fun main() = application {
// Faster scrolling in Swing components
enableNewSwingCompositing()
fun main() {
System.setProperty("apple.awt.application.name", "Kotlin Explorer")

val explorerState = remember { ExplorerState() }
application {
// Faster scrolling in Swing components
enableNewSwingCompositing()

val windowState = rememberWindowState(
size = explorerState.getWindowSize(),
position = explorerState.getWindowPosition(),
placement = explorerState.windowPlacement,
)
val explorerState = remember { ExplorerState() }

Runtime.getRuntime().addShutdownHook(Thread {
shutdown(explorerState, windowState)
})
val windowState = rememberWindowState(
size = explorerState.getWindowSize(),
position = explorerState.getWindowPosition(),
placement = explorerState.windowPlacement,
)

val themeDefinition = if (KotlinExplorerTheme.System.isDark()) {
JewelTheme.darkThemeDefinition()
} else {
JewelTheme.lightThemeDefinition()
}
val titleBarStyle = if (KotlinExplorerTheme.System.isDark()) {
TitleBarStyle.dark()
} else {
TitleBarStyle.light()
}
Runtime.getRuntime().addShutdownHook(Thread {
shutdown(explorerState, windowState)
})

IntUiTheme(
themeDefinition,
ComponentStyling.decoratedWindow(titleBarStyle = titleBarStyle),
false
) {
DecoratedWindow(
state = windowState,
onCloseRequest = {
explorerState.setWindowState(windowState)
exitApplication()
},
title = "Kotlin Explorer"
val themeDefinition = if (KotlinExplorerTheme.System.isDark()) {
JewelTheme.darkThemeDefinition()
} else {
JewelTheme.lightThemeDefinition()
}
val titleBarStyle = if (KotlinExplorerTheme.System.isDark()) {
TitleBarStyle.dark()
} else {
TitleBarStyle.light()
}

IntUiTheme(
themeDefinition,
ComponentStyling.decoratedWindow(titleBarStyle = titleBarStyle),
false
) {
TitleBar(Modifier.newFullscreenControls()) {
Text("Kotlin Explorer")
DecoratedWindow(
state = windowState,
onCloseRequest = {
explorerState.setWindowState(windowState)
exitApplication()
},
title = "Kotlin Explorer"
) {
TitleBar(Modifier.newFullscreenControls()) {
Text("Kotlin Explorer")
}
KotlinExplorer(explorerState)
}
KotlinExplorer(explorerState)
}
}
}
Expand Down

0 comments on commit 6364e88

Please sign in to comment.