I recently set Hyper as the default command interpreter for XYplorer. Every time a command is executed, it creates a new instance of Hyper. Is there any way to prevent multiple instances of Hyper from being created? Preferably, each subsequent call to Hyper would result in a new tab.
@Enteleform https://www.npmjs.com/package/hyper-open-tab-in-system-context-menu , i recently write a plugin. you can have a try. I wont to open a single instance too.
@ivanwonder
Nice plugin, it works great!
I'm confused by the name though. Not sure what system-context-menu has to do with the actual functionality.
What do you think about renaming the package to hyper-single-instance? Also, I can submit a pull-request to update the README.md description & add a GIF animation to demonstrate the plugin's functionality if you're interested.
Awesome that this plugin solved it, I also think hyper-single-instance is a better name, you can read about submitting this plugin to the https://hyper.is/plugins store here
@Enteleform I use the name because it creates a new instance of Hyper only when you click the open hyper here in the right-click menu on windows. thanks for your name, it's better than mine. and welcome to pull request. sorry about my poor README.md description.
@albinekb thanks, i will read that.
@ivanwonder
Your plugin seems to work in all contexts.
For example, if you run hyper c:\any\path in another command interpreter, the existing instance of Hyper will open a new tab @ c:\any\path.
Which is great, because my original intention was to pass ongoing processes from my build scripts into Hyper.
Let me know when you change the repo to hyper-single-instance and I'll submit the pull request that I mentioned.
I think that this plugin is only useful on Windows. I think that is already Hyper behaviour on macOS.
If I run multiple times hyper <path>, it opens tabs in a unique window.
BTW awesome collaboration :heart:
@chabou I just read the http://electronjs.org/docs/api/app#appmakesingleinstancecallback. and I think the plugin should have no effect on macOS. I have not yet tested on macOS.
@Enteleform https://www.npmjs.com/package/hyper-single-instance.
@chabou @ivanwonder
Based on the documentation, it seems like this plugin should still be useful for macOS if you are launching Hyper via another command interpreter:
On macOS the system enforces single instance automatically when users try to open a second instance of your app in Finder, and the open-file and open-url events will be emitted for that.
* However when users start your app in command line the system's single instance mechanism will be bypassed and you have to use this method to ensure single instance. *
@chabou
This seems like it might conflict with what you mentioned earlier though. Can you clarify what you meant by:
If I run multiple times
hyper <path>, it opens tabs in a unique window.
Do you mean that each time hyper <path> is executed, a new Hyper window is created? Or that each execution will result in a new tab being created in a single-instance Hyper window?
Each time hyper <path> is executed a new tab is created in a single-instance Hyper window.
macOS does not support multiple instances of one app (only multiple windows) to my knowledge, that's why it's always in the single instance 馃憤
Most helpful comment
@chabou I just read the http://electronjs.org/docs/api/app#appmakesingleinstancecallback. and I think the plugin should have no effect on macOS. I have not yet tested on macOS.
@Enteleform https://www.npmjs.com/package/hyper-single-instance.