2019-04-05 19:40:00 +11:00
|
|
|
'use strict'
|
|
|
|
|
2019-04-09 01:06:28 +10:00
|
|
|
import { pick } from 'lodash'
|
2019-04-06 22:38:17 +11:00
|
|
|
import {
|
2019-04-09 01:06:28 +10:00
|
|
|
app,
|
|
|
|
ipcMain,
|
|
|
|
protocol,
|
|
|
|
Event,
|
|
|
|
} from 'electron'
|
|
|
|
|
2019-04-06 22:38:17 +11:00
|
|
|
import ContextMenu from 'electron-context-menu'
|
2019-04-10 20:35:55 +10:00
|
|
|
|
|
|
|
import Application from './main/Application'
|
|
|
|
import ApplicationMenu from "./main/ApplicationMenu";
|
2019-04-08 01:55:27 +10:00
|
|
|
|
2019-04-09 01:06:28 +10:00
|
|
|
export type PackageJson = typeof import('../package.json');
|
2019-04-22 16:29:48 +10:00
|
|
|
import { author, homepage } from '../package.json'
|
2019-04-09 01:06:28 +10:00
|
|
|
import TheDeskInfo from '../info.json'
|
|
|
|
export type TheDeskInfoObject = typeof TheDeskInfo;
|
2019-04-06 02:38:20 +11:00
|
|
|
|
2019-04-09 01:06:28 +10:00
|
|
|
ipcMain.on('thedesk-info', (event: Event) => {
|
2019-04-09 01:38:04 +10:00
|
|
|
event.returnValue = Object.assign({
|
2019-04-09 01:06:28 +10:00
|
|
|
productName: app.getName(),
|
2019-04-22 16:29:48 +10:00
|
|
|
author: author,
|
2019-04-09 01:06:28 +10:00
|
|
|
homePage: homepage,
|
2019-04-09 01:38:04 +10:00
|
|
|
versions: Object.assign(pick(process.versions, ["chrome", "electron", "node"]), { internal: app.getVersion() }),
|
2019-04-09 01:06:28 +10:00
|
|
|
}, TheDeskInfo)
|
|
|
|
})
|
2019-04-05 19:40:00 +11:00
|
|
|
|
2019-04-09 01:06:28 +10:00
|
|
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
2019-04-05 19:40:00 +11:00
|
|
|
|
2019-04-09 01:06:28 +10:00
|
|
|
if (isDevelopment) {
|
|
|
|
if (process.platform === 'win32') {
|
|
|
|
process.on('message', data => {
|
|
|
|
if (data === 'graceful-exit') {
|
|
|
|
app.quit()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
process.on('SIGTERM', () => {
|
|
|
|
app.quit()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2019-04-05 23:19:58 +11:00
|
|
|
|
2019-04-05 19:40:00 +11:00
|
|
|
protocol.registerStandardSchemes(['app'], { secure: true })
|
2019-04-06 22:38:17 +11:00
|
|
|
|
2019-04-10 20:35:55 +10:00
|
|
|
ContextMenu()
|
2019-04-09 01:06:28 +10:00
|
|
|
|
2019-04-10 20:35:55 +10:00
|
|
|
const TheDeskVueApp: Application = Application.shared
|
|
|
|
TheDeskVueApp.setApplicationMenu(ApplicationMenu.buildTemplate())
|