https://kotlinlang.org logo
#compose-desktop
Title
# compose-desktop
v

Vedran

03/26/2024, 10:24 PM
Does someone know what is the way of starting detached process from kotlin compose? (Specifically on Windows)... I have two apps. User is first on app A. After some time, app A has to start app B. When app B starts it should close app A. => Since app A is parent, when it stops it also kills and shutsdown app B. I tried starting process with 'start' command and also tried to just run powershell script which would kill app A and start app B, but execution of scritpt also stops soon as app A is killed. I still can and will try with scheduling task, but I'm kinda losing hope.
z

Zach Klippenstein (he/him) [MOD]

03/27/2024, 2:37 AM
Compose doesn’t have anything to do with process management
m

Mike Dawson

03/27/2024, 6:52 AM
It doesn't involve Compose, but in my Compose desktop app I had to make sure that there would never be more than one instance (which happens automatically on Mac, not on Windows/Linux). I used JUnique: it can also be used to pass messages between instances: https://github.com/terjedahl/junique
In my case if the user started another copy of my app, then the already running copy would be brought to the front and the new copy would exit
v

Vedran

03/27/2024, 8:03 AM
But Im not starting another copy of my app... Im starting another app from my main app... And if the main app gets shutdown it will close this another app as well.
m

Mike Dawson

03/27/2024, 8:40 AM
If that other app is also JVM based, and an app that you control, then you can still use the messaging capability in JUnique to control when things start, stop, etc. App A could hide once app b starts and wait for process b to finish before actually closing.
a

Alexander Maryanovsky

03/27/2024, 8:42 AM
Looks like you’ll have to resort to platform-specific means. But please not here, as it’s not related to Compose.
v

Vedran

03/27/2024, 2:49 PM
@Alexander Maryanovsky Yeah, my bad for pointing it as compose stuff. Because It's my first encounter with it so I just went out without looking. @Mike Dawson I dont think this would work for me. My second app is Updater app for my first app. In order to update the app you need to close it, hide would not help.
4 Views