WhiteMagic / JoystickGremlin

A tool for configuring and managing joystick devices.
http://whitemagic.github.io/JoystickGremlin/
GNU General Public License v3.0
306 stars 45 forks source link

Show the already running instance instead of launching a new instance #525

Open someonemax opened 3 months ago

someonemax commented 3 months ago

When JS Gremlin is already running, if you launch the application again, it will open another instance.

I think the better and more standard behavior (which most applications use), is to show the already running instance, rather than to launch another instance of the application (running in parallel to the first one).

Apart from the fact that the current behavior is not useful, the second instance won't even run properly and throws an error, presumably because it can't get control of the vJoy device or some files.

So I suggest bringing the behavior in line with what most applications do, which is for the second instance to check whether another instance of the application is already running, on startup, and if so, signal the already running instance to open if minimized to system tray, and for the second instance to exit.

This will not only prevent inadvertently starting more instances of the application when it's already running, but also give the users an easy way to maximize the application that has been minimized to system tray, by attempting to launch a new instance (e.g. through start menu using keyboard), rather than moving the mouse all the way to the system tray area to click on the tray icon.

WhiteMagic commented 3 months ago

In general I agree, though the unknown aspects of this are how this can be achieved with Gremlin being "compiled" with pyinstaller and wrapper in some windows launch aspects.