Merge branch 'testing'
This commit is contained in:
commit
32ddac6672
17
main.js
17
main.js
|
@ -10,10 +10,13 @@ const trayService = require(__dirname+'/modules/tray-service')
|
|||
const menuService = require(__dirname+'/modules/menu-service')
|
||||
const settingsService = require(__dirname+'/modules/settings-service')
|
||||
|
||||
const isMac = process.platform === 'darwin'
|
||||
const isWin = process.platform === 'win32'
|
||||
|
||||
function initApp() {
|
||||
createWindow()
|
||||
// Set Windows platform notifications
|
||||
if (process.platform === 'win32') {
|
||||
if (isWin) {
|
||||
app.setAppUserModelId("com.denry.chimeverse")
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +80,18 @@ function createWindow () {
|
|||
})
|
||||
}
|
||||
|
||||
// Handle shutdown event on Mac with minimizeOnClose
|
||||
// to prevent shutdown interrupt
|
||||
if (isMac) {
|
||||
if (minimizeOnClose) {
|
||||
const { powerMonitor } = require('electron')
|
||||
powerMonitor.on('shutdown', () => {
|
||||
app.isQuitting = true
|
||||
app.quit()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Save window size
|
||||
if (preserveWindowSize) {
|
||||
mainWindow.on('resize', (e) => {
|
||||
|
|
|
@ -9,19 +9,23 @@ let menuService = {}
|
|||
|
||||
menuService.createMenu = () => {
|
||||
|
||||
const isMac = process.platform === 'darwin'
|
||||
|
||||
const about = {
|
||||
label: 'About Chimeverse',
|
||||
click: () => {
|
||||
// @see https://github.com/electron/electron/issues/16558#issuecomment-484460276
|
||||
// let activeWindow = BrowserWindow.getFocusedWindow()
|
||||
let activeWindow = BrowserWindow.getAllWindows()[0]
|
||||
activeWindow.show()
|
||||
activeWindow.webContents.send('about-page-event')
|
||||
}
|
||||
}
|
||||
|
||||
const application = {
|
||||
label: 'Chimeverse',
|
||||
submenu: [
|
||||
{
|
||||
label: 'About Chimeverse',
|
||||
click: () => {
|
||||
// @see https://github.com/electron/electron/issues/16558#issuecomment-484460276
|
||||
// let activeWindow = BrowserWindow.getFocusedWindow()
|
||||
let activeWindow = BrowserWindow.getAllWindows()[0]
|
||||
activeWindow.show()
|
||||
activeWindow.webContents.send('about-page-event')
|
||||
}
|
||||
},
|
||||
... isMac ? [about] : [],
|
||||
{
|
||||
label: 'Reconnect',
|
||||
accelerator: 'CmdOrCtrl+R',
|
||||
|
@ -103,7 +107,12 @@ menuService.createMenu = () => {
|
|||
],
|
||||
}
|
||||
|
||||
const template = [application, edit]
|
||||
const help = {
|
||||
label: 'Help',
|
||||
submenu: [about]
|
||||
}
|
||||
|
||||
const template = [application, edit, ... !isMac ? help : []]
|
||||
|
||||
Menu.setApplicationMenu(Menu.buildFromTemplate(template))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue