Anders Carlsen
03/12/2024, 3:23 PMfun checkForSingleInstance(onExit: () -> Unit) {
when (hostOs) {
OS.Windows -> {
val handle = User32.INSTANCE.FindWindow(null, windowTitle.uppercase())
if (handle != null) {
User32.INSTANCE.ShowWindow(handle, User32.SW_SHOWNORMAL)
onExit()
}
}
else -> {
// do nothing
}
}
}
My issue is if the app is minimized to Tray using visible property on Window, then the window is shown correct when starting another instance, but I can not interact with anything other that the Toolbar Min/Max/Close buttons until I use a Tray action to reset the visible property (resizing the window also just add white space like the Compose engine is not running). What am I missing?Matt Nelson
03/12/2024, 3:32 PM.lock
file and deleteOnExit
which would be checked for at startup.
UI was very simple "app is already open. If this is incorrect, delete file xyz/.lock"Anders Carlsen
03/12/2024, 3:35 PMAlexander Zhirkevich
03/12/2024, 3:48 PMAnders Carlsen
03/12/2024, 3:54 PMMatt Nelson
03/12/2024, 3:54 PM.lock
file as well, lol.Anders Carlsen
03/12/2024, 3:55 PMAnders Carlsen
03/12/2024, 3:55 PMMatt Nelson
03/12/2024, 3:56 PM.lock
file concept with Unix Domain Sockets which will resolve that hard crash problem (drops it to the FS to clean up when the process owner exits)