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