Hiding dock icon for MacOS
Some checks failed
Release Pipeline / Bump Version & Create Tag (push) Has been cancelled
Release Pipeline / Package Linux (DEB) (push) Has been cancelled
Release Pipeline / Package macOS (DMG) (push) Has been cancelled
Release Pipeline / Package Windows (MSI) (push) Has been cancelled
Release Pipeline / Create GitHub & Forgejo Releases (push) Has been cancelled
Some checks failed
Release Pipeline / Bump Version & Create Tag (push) Has been cancelled
Release Pipeline / Package Linux (DEB) (push) Has been cancelled
Release Pipeline / Package macOS (DMG) (push) Has been cancelled
Release Pipeline / Package Windows (MSI) (push) Has been cancelled
Release Pipeline / Create GitHub & Forgejo Releases (push) Has been cancelled
This commit is contained in:
parent
846794fa36
commit
8b054cd33d
3 changed files with 25 additions and 3 deletions
|
|
@ -70,7 +70,7 @@ compose.desktop {
|
||||||
application {
|
application {
|
||||||
mainClass = "com.rukira.wowbackup.MainKt"
|
mainClass = "com.rukira.wowbackup.MainKt"
|
||||||
|
|
||||||
jvmArgs("-Dapple.awt.enableTemplateImages=true")
|
jvmArgs("-Dapple.awt.enableTemplateImages=true", "-Dapple.awt.UIElement=true")
|
||||||
|
|
||||||
nativeDistributions {
|
nativeDistributions {
|
||||||
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
|
||||||
|
|
@ -82,6 +82,12 @@ compose.desktop {
|
||||||
macOS {
|
macOS {
|
||||||
bundleID = "com.rukira.wowbackup"
|
bundleID = "com.rukira.wowbackup"
|
||||||
iconFile.set(project.file("src/jvmMain/resources/icon.icns"))
|
iconFile.set(project.file("src/jvmMain/resources/icon.icns"))
|
||||||
|
infoPlist {
|
||||||
|
extraKeysRawXml = """
|
||||||
|
<key>LSUIElement</key>
|
||||||
|
<true/>
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
windows {
|
windows {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,9 @@ import java.awt.GraphicsEnvironment
|
||||||
private val logger = KotlinLogging.logger {}
|
private val logger = KotlinLogging.logger {}
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
|
if (Platform.current == OS.Mac) {
|
||||||
|
System.setProperty("apple.awt.UIElement", "true")
|
||||||
|
}
|
||||||
LoggingSetup.init()
|
LoggingSetup.init()
|
||||||
logger.info { "WoW Backup starting" }
|
logger.info { "WoW Backup starting" }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,18 +84,31 @@ Strip all template code. Route to placeholder screens based on `currentScreen`:
|
||||||
### Step 5: Auto-show config if not configured
|
### Step 5: Auto-show config if not configured
|
||||||
In `main.kt`, on startup check `ConfigManager.isConfigured`. If false, set `currentScreen = Screen.CONFIG` and `isWindowVisible = true`.
|
In `main.kt`, on startup check `ConfigManager.isConfigured`. If false, set `currentScreen = Screen.CONFIG` and `isWindowVisible = true`.
|
||||||
|
|
||||||
### Step 6: macOS JVM args
|
### Step 6: macOS JVM args and Dock hiding (LSUIElement)
|
||||||
**Files to modify:**
|
**Files to modify:**
|
||||||
- `composeApp/build.gradle.kts` — add to desktop application config:
|
- `composeApp/build.gradle.kts` — add to desktop application config:
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
compose.desktop {
|
compose.desktop {
|
||||||
application {
|
application {
|
||||||
jvmArgs("-Dapple.awt.enableTemplateImages=true")
|
jvmArgs("-Dapple.awt.enableTemplateImages=true", "-Dapple.awt.UIElement=true")
|
||||||
|
|
||||||
|
nativeDistributions {
|
||||||
|
macOS {
|
||||||
|
infoPlist {
|
||||||
|
extraKeysRawXml = """
|
||||||
|
<key>LSUIElement</key>
|
||||||
|
<true/>
|
||||||
|
""".trimIndent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Also set `System.setProperty("apple.awt.UIElement", "true")` in `main.kt` for macOS so that the dock icon is suppressed during development runs.
|
||||||
|
|
||||||
## Verification
|
## Verification
|
||||||
1. `./gradlew composeApp:run` — app launches with tray icon visible
|
1. `./gradlew composeApp:run` — app launches with tray icon visible
|
||||||
2. Tray icon shows context menu with Status, Settings, Quit
|
2. Tray icon shows context menu with Status, Settings, Quit
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue