commit 175f655156d5132e5a159a39e10e3e2aa7e6f188
parent 2414653336d1d03707c90ad7246ef4138e7e3fe8
Author: triesap <tyson@radroots.org>
Date: Fri, 14 Aug 2026 17:27:01 +0000
ui: hide the redundant macOS window title
- Preserve the product name on non-macOS desktop hosts
- Keep native macOS traffic-light controls visible
- Retain the HarvestCircle accessibility window name
- Cover the platform title behavior with focused tests
Diffstat:
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/app/desktop/src/main/kotlin/org/harvestcircle/desktop/Main.kt b/app/desktop/src/main/kotlin/org/harvestcircle/desktop/Main.kt
@@ -32,6 +32,7 @@ import java.security.SecureRandom
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeoutException
+import javax.accessibility.AccessibleContext
import javax.imageio.ImageIO
import javax.swing.JRootPane
import kotlin.system.exitProcess
@@ -67,7 +68,7 @@ fun main(args: Array<String>) {
onCloseRequest = {
if (nativeStartupProblem == null) closeRequested = true else exitApplication()
},
- title = APPLICATION_NAME,
+ title = desktopWindowTitle(isMacOs),
state =
rememberWindowState(
width = INITIAL_WINDOW_WIDTH.dp,
@@ -78,7 +79,7 @@ fun main(args: Array<String>) {
window.minimumSize = Dimension(MINIMUM_WINDOW_WIDTH, MINIMUM_WINDOW_HEIGHT)
if (isMacOs) {
- configureMacOsWindowChrome(window.rootPane)
+ configureMacOsWindowChrome(window.rootPane, window.accessibleContext)
}
onDispose { }
@@ -96,10 +97,16 @@ fun main(args: Array<String>) {
}
}
-internal fun configureMacOsWindowChrome(rootPane: JRootPane) {
+internal fun desktopWindowTitle(macOs: Boolean): String = if (macOs) "" else APPLICATION_NAME
+
+internal fun configureMacOsWindowChrome(
+ rootPane: JRootPane,
+ windowAccessibility: AccessibleContext,
+) {
rootPane.putClientProperty("apple.awt.fullWindowContent", true)
rootPane.putClientProperty("apple.awt.transparentTitleBar", true)
rootPane.putClientProperty("apple.awt.windowTitleVisible", true)
+ windowAccessibility.accessibleName = APPLICATION_NAME
}
internal fun isHealthCheck(args: Array<String>): Boolean = args.size == 1 && args.single() == HEALTH_CHECK_ARGUMENT
diff --git a/app/desktop/src/test/kotlin/org/harvestcircle/desktop/MainTest.kt b/app/desktop/src/test/kotlin/org/harvestcircle/desktop/MainTest.kt
@@ -23,14 +23,17 @@ class MainTest {
}
@Test
- fun macOsWindowChromeKeepsNativeControlsVisible() {
+ fun macOsWindowChromeHidesTheVisualTitleButKeepsNativeControlsAndAccessibility() {
val rootPane = JRootPane()
- configureMacOsWindowChrome(rootPane)
+ configureMacOsWindowChrome(rootPane, rootPane.accessibleContext)
+ assertEquals("", desktopWindowTitle(macOs = true))
+ assertEquals("HarvestCircle", desktopWindowTitle(macOs = false))
assertEquals(true, rootPane.getClientProperty("apple.awt.fullWindowContent"))
assertEquals(true, rootPane.getClientProperty("apple.awt.transparentTitleBar"))
assertEquals(true, rootPane.getClientProperty("apple.awt.windowTitleVisible"))
+ assertEquals("HarvestCircle", rootPane.accessibleContext.accessibleName)
}
@Test