toptensoftware / VBoxHeadlessTray

Run a VirtualBox machine in a tray icon
180 stars 23 forks source link

Start machine if already in tray, rather than duplicate instance #13

Open GreenReaper opened 9 years ago

GreenReaper commented 9 years ago

If you launch VBoxHeadlessTray with the same arguments, with the tray app already running, it will fail to open the log file (with "error 13") and pause execution until you dismiss the dialog box. The machine subsequently launches but you end up with two instance of VBoxHeadless and VBoxHeadlessTray.

I would expect it to transfer execution to the existing tray instance responsible for this VM, and tell it to start the VM if it is not already started. This results in the same end state as if it had not been run first: one instance controlling a running VM.

My use case: I have a scheduled task that starts a virtual machine. A few minutes later, that machine backs up another server; it then shuts itself down (hours later). Unlike the VirtualBox GUI, the tray icon sticks around when this happens, and next time there is an error and the backup does not take place.

It wouldn't be so much of a problem if there was an option to have the tray icon close on machine halt; however, it could still trip someone up who is trying to run an existing machine. I don't think there is a particular reason to support having two icons in the same window station for the same machine.

(I don't want to run VBox as a service; I'd like to know when it's running and be able to pause it, etc. But I also don't want it taking up a large chunk of my taskbar, using up CPU for console output, etc.)