mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
handle macOS activate
This commit is contained in:
parent
a4bfd0ae1e
commit
624b7c3992
2 changed files with 15 additions and 2 deletions
|
|
@ -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` ?)
|
||||
|
|
|
|||
14
index.js
14
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([
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue