Info.plist for a desktop app

Hi,

I’m building a KMP desktop app. Currently testing on MacOS.
I have two questions:

  1. How can I add keys to the info.plist file as it doesn’t exist in the codebase and is only created when installing the app? (I need to add a key to prevent the app from showing in the dock)
  2. How can I make the app not show any window when it starts? I want the app to only show the tray icon and no window.

My goal is to create an app that sits on the system tray and only when the icon is clicked - show the window.

This is how to make the app not visible in the doc:

Basically I only need to add this to the plist:

<key>LSUIElement</key>
<true/>

You can add custom keys to the infoPlist in the your gradle config as explained here.

Here’s how I did it:


compose.desktop {
    application {
       ...
        nativeDistributions {
           ...
            macOS {
               ...
                infoPlist {
                    extraKeysRawXml = macExtraPlistKeys
                }
            }
        }
    }
}

val macExtraPlistKeys: String
    get() = """
      <key>LSUIElement</key>
      <true/>
    """.trimIndent()

Thank you! This is really helpful.

1 Like