Is it already possible to change the text "MainKt"...
# compose-desktop
s
Is it already possible to change the text "MainKt" in the top left corner on MacOS so something else?
โœ… 1
a
MainKt is the name of the main app class. If you move main function to another class and tell gradle to use it as a start point, its name will appear there instead of MainKt
b
But that'd still end with
Kt
I'd argue that
MainKt
is the best app name you could have, why would you want anything else? ๐Ÿ˜„
c
s
No, but maybe it does only work in the final distribution and "gradle run" won't change it.
Thanks anyway ๐Ÿ™‚
s
Thanks, Jim. Seems not to work with Compose dor Desktop ๐Ÿ˜• I tried
Copy code
fun main() {

    System.setProperty(
        "com.apple.mrj.application.apple.menu.about.name",
        "MyApp"
    )

    Window(
and
Copy code
compose.desktop {
    application {

        mainClass = "MainKt"

        jvmArgs += listOf("-Dcom.apple.mrj.application.apple.menu.about.name=MyApp")
Does it work for you?
j
Ah, looks like the system property got renamed to
apple.awt.application.name
. If you replace your system property that line in the first code block with
System.setProperty("apple.awt.application.name", "MyApp");
then it appears to work for me. Can you give that a try? Does that work for you?
๐Ÿ™ 1
s
Yes, that works. Very nice. Thank you. ๐Ÿ™‚
m
One problem remains though. When the application is running and you move your mouse cursor over the app icon displayed in the dock or launchpad then it displays โ€œjavaโ€ instead of โ€œMyAppโ€.
s
Let me know if you got a solution for that. ๐Ÿ˜‰ For my prototype showcase to the stakeholders this solution was good enough. ๐Ÿ™‚ Thanks again, @jim
j
Glad to hear you're unblocked. Regarding hover text, I'm not entirely sure. Other Java applications manage to set the text correctly, so it's surely possible. When searching, it's worth noting that these questions are just general Java application questions - nothing unique to Compose here.
๐Ÿ‘ 1
m
In order to get these things right you have to use the full packaging options because that also adds this kind of information to the right places. And why not. Packaging is so easy ๐Ÿ˜€
๐Ÿ‘ 1
s
@Michael Paus Yes, if packaged as App it's working as intended and only the "gradle run" thing is affected. That makes it a non-issue for me because I surely can avoid hovering my mouse there during a presentation of a dev build to stakeholders. ๐Ÿ˜‰
217 Views