theosanderson / taxonium

A tool for exploring very large trees in the browser
http://taxonium.org
GNU General Public License v3.0
98 stars 16 forks source link

ENH: Multi-tree in Electron #429

Open corneliusroemer opened 1 year ago

corneliusroemer commented 1 year ago

Electron only allows one instance to be running at any point in time.

It would be neat if one could open multiple trees in parallel - I may want to compare trees, or work on two pathogens in parallel etc.

Right now this doesn't work with the setup. Maybe it's easy to create a new "window" though.

Workaround: open -n "/Applications/Taxonium.app" or even better: open -nb com.electron.taxonium

Put this in ~/.zshrc:

alias taxonium="open -nb com.electron.taxonium"

To open new instance with taxonium from CLI

theosanderson commented 1 year ago

So I think I kind of fixed this recently in that the port selected is now random, so you can have multiple independent instances (maybe that is what you meant by the last sentence). I think that is the preference, and that if I were to add a New window button it would just literally launch another process.

corneliusroemer commented 1 year ago

I don't think you can have real independent instances though. There's always going to be just 1 instance of taxonium.

I think you need to handle multiple windows within the Electron app, somehow spawning a new window that's a copy.

theosanderson commented 1 year ago

Ah I hadn't realised MacOS doesn't typically allow multiple instances, other OSes do. Workaround for now https://www.totalphase.com/support/articles/200349376-Multiple-Application-Instances-on-Mac-OS-X#:~:text=Trying%20to%20use%20the%20Finder,if%20one%20is%20already%20running. but agreed on the issue

corneliusroemer commented 1 year ago

Oh very cool that this works. I had no clue.

Yet another usecase for a taxonium CLI :)

Do you know whether it'd be easy pass an argument to taxonium when opening via command line? This shouldn't be too hard...

CLI could also have a verbosity/debug argument to output console errors to a log file for better debugging :)

https://stackoverflow.com/questions/30815446/how-to-pass-command-line-argument-in-electron