OS X fixes
This commit is contained in:
28
electron.js
28
electron.js
@@ -84,9 +84,17 @@ function createWindow() {
|
||||
protocol: 'file:',
|
||||
slashes: true
|
||||
});
|
||||
mainWindow.loadURL(startUrl);
|
||||
|
||||
// Emitted when the window is closed.
|
||||
mainWindow.on('close', function (event) {
|
||||
if (!isQuiting) {
|
||||
event.preventDefault();
|
||||
if (mainWindow.isVisible()) {
|
||||
setWindowVisibility(false);
|
||||
}
|
||||
event.returnValue = false;
|
||||
}
|
||||
});
|
||||
|
||||
mainWindow.on('closed', function () {
|
||||
// Dereference the window object, usually you would store windows
|
||||
// in an array if your app supports multi windows, this is the time
|
||||
@@ -112,7 +120,6 @@ function createWindow() {
|
||||
path: appPath,
|
||||
});
|
||||
|
||||
const image = nativeImage.createFromPath(path.join(__dirname, (os.platform() === 'darwin') ? '/build/logo_mac.png' : '/build/logo.png'));
|
||||
trayContextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
label: 'Visible', type: 'checkbox', click(item) {
|
||||
@@ -149,28 +156,21 @@ function createWindow() {
|
||||
}
|
||||
]);
|
||||
|
||||
mainWindow.on('close', function (event) {
|
||||
if (!isQuiting) {
|
||||
event.preventDefault();
|
||||
if (mainWindow.isVisible()) {
|
||||
setWindowVisibility(false);
|
||||
}
|
||||
event.returnValue = false;
|
||||
}
|
||||
});
|
||||
const image = nativeImage.createFromPath(path.join(__dirname, (os.platform() === 'darwin') ? '/build/logo_mac.png' : '/build/logo.png'));
|
||||
mainWindowTray = new Tray(image);
|
||||
|
||||
autoLauncher
|
||||
.isEnabled()
|
||||
.then((enabled) => {
|
||||
trayContextMenu.items[1].checked = enabled;
|
||||
|
||||
mainWindowTray = new Tray(image);
|
||||
mainWindowTray.setToolTip('Repertory UI');
|
||||
mainWindowTray.setContextMenu(trayContextMenu)
|
||||
})
|
||||
.catch(() => {
|
||||
closeApplication();
|
||||
});
|
||||
|
||||
mainWindow.loadURL(startUrl);
|
||||
}
|
||||
|
||||
const instanceLock = app.requestSingleInstanceLock();
|
||||
|
||||
@@ -66,7 +66,8 @@
|
||||
"start": "node scripts/start.js",
|
||||
"build": "node scripts/build.js",
|
||||
"test": "node scripts/test.js --env=jsdom",
|
||||
"electron-dev": "cross-env ELECTRON_START_URL=http://localhost:3000 electron .",
|
||||
"electron-dev": "cross-env ELECTRON_START_URL=http://localhost:3000 electron %NODE_DEBUG_OPTION% .",
|
||||
"electron-dev-unix": "cross-env ELECTRON_START_URL=http://localhost:3000 electron $NODE_DEBUG_OPTION .",
|
||||
"pack": "npm run build && electron-builder --dir",
|
||||
"dist": "npm run build && electron-builder"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user