Merge pull request #85 from gerryhernandez/fixPastingPassword

Fix broken copy/paste and app quitting on macOS
This commit is contained in:
SideQuest
2020-10-20 07:51:38 +01:00
committed by GitHub
+15 -7
View File
@@ -535,7 +535,11 @@ function setupMenu() {
label: 'Quit', label: 'Quit',
accelerator: 'Command+Q', accelerator: 'Command+Q',
click: function() { click: function() {
app.quit(); // Mac users expect an application to quit immediately with Command+Q. However, app.quit() is
// being interrupted by the main window while it's closing. So instead, let's asynchronously
// trigger the quit once the main window is done closing.
mainWindow.once('closed', app.quit);
mainWindow.close();
}, },
}, },
], ],
@@ -546,33 +550,33 @@ function setupMenu() {
{ {
label: 'Undo', label: 'Undo',
accelerator: 'CmdOrCtrl+Z', accelerator: 'CmdOrCtrl+Z',
// selector: 'undo:', role: 'undo',
}, },
{ {
label: 'Redo', label: 'Redo',
accelerator: 'Shift+CmdOrCtrl+Z', accelerator: 'Shift+CmdOrCtrl+Z',
// selector: 'redo:', role: 'redo',
}, },
{ type: 'separator' }, { type: 'separator' },
{ {
label: 'Cut', label: 'Cut',
accelerator: 'CmdOrCtrl+X', accelerator: 'CmdOrCtrl+X',
// selector: 'cut:' role: 'cut',
}, },
{ {
label: 'Copy', label: 'Copy',
accelerator: 'CmdOrCtrl+C', accelerator: 'CmdOrCtrl+C',
// selector: 'copy:', role: 'copy',
}, },
{ {
label: 'Paste', label: 'Paste',
accelerator: 'CmdOrCtrl+V', accelerator: 'CmdOrCtrl+V',
// selector: 'paste:', role: 'paste',
}, },
{ {
label: 'Select All', label: 'Select All',
accelerator: 'CmdOrCtrl+A', accelerator: 'CmdOrCtrl+A',
// selector: 'selectAll:', role: 'selectAll',
}, },
], ],
}, },
@@ -605,6 +609,10 @@ function setupApp() {
// Quit when all windows are closed. // Quit when all windows are closed.
app.on('window-all-closed', function() { app.on('window-all-closed', function() {
if (process.platform !== 'darwin') app.quit(); if (process.platform !== 'darwin') app.quit();
});
// Kill the adb client when the app is definitely quitting, regardless of how it quit.
app.on('will-quit', () => {
if (adb.client) adb.client.kill(); if (adb.client) adb.client.kill();
}); });