diff --git a/Readme.md b/Readme.md index 26b33655..6266a4a3 100644 --- a/Readme.md +++ b/Readme.md @@ -3,7 +3,8 @@ ## TODO - [ ] Listen on `resize` event *coming* from the pty. -- [ ] Add support for zsh and other popular shells +- [ ] Make sure all popular shells work well, and that we detect + "url commands" appropriately for them. - [ ] Figure out process title extraction on other platforms. - [ ] Define extensibility surface and APIs - [ ] Define approach to conf management (`~/.hyperterm.json` ?) diff --git a/index.js b/index.js index b2467b8b..d51981f7 100644 --- a/index.js +++ b/index.js @@ -28,6 +28,8 @@ app.on('window-all-closed', () => { // terminal is closed }); +let winCount = 0; + app.on('ready', () => { function createWindow (fn) { let win = new BrowserWindow({ @@ -41,7 +43,7 @@ app.on('ready', () => { // is ready for user input show: process.env.HYPERTERM_DEBUG || isDev }); - + winCount++; win.loadURL(url); const rpc = createRPC(win); @@ -117,6 +119,7 @@ app.on('ready', () => { win.on('close', () => { rpc.destroy(); deleteSessions(); + winCount--; }); win.rpc = rpc; @@ -125,6 +128,15 @@ app.on('ready', () => { // when opening create a new window createWindow(); + // mac only. when the dock icon is clicked + // and we don't have any active windows open, + // we open one + app.on('activate', () => { + if (!winCount) { + createWindow(); + } + }); + // set menu Menu.setApplicationMenu(Menu.buildFromTemplate([ {