-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.js
60 lines (53 loc) · 1.55 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const { app, shell, BrowserWindow, Menu, } = require('electron')
const path = require('path')
const config = {
useContentSize: true,
width: 1281,
height: 800,
center: true,
backgroundColor: '#fff',
title: 'Office 365 - Mail',
icon: path.resolve(__dirname, 'assets/icons/png/256x256.png'),
show: true,
autoHideMenuBar: true,
webPreferences: {
webSecurity: false,
nodeIntegration: false,
allowDisplayingInsecureContent: true,
allowRunningInsecureContent: true,
plugins: true,
preload: path.resolve(__dirname, 'src/preload.js'),
},
}
app.on('window-all-closed', function () {
process.platform !== 'darwin' && app.quit()
})
app.on('ready', function () {
Menu.setApplicationMenu(Menu.buildFromTemplate(require('./src/menu')))
let win = new BrowserWindow(config)
win.loadURL('https://outlook.office365.com', {
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36',
})
win.on('closed', function () {
win = null
})
win.webContents.on('new-window', function (event, url) {
event.preventDefault()
shell.openExternal(url)
})
// Prevent copy and cut from being stolen by other hotkeys
win.webContents.on('before-input-event', (e, input) => {
if (input.key === 'c' && input.control) {
win.webContents.copy();
e.preventDefault();
return false;
}
if (input.key === 'x' && input.control) {
win.webContents.cut();
e.preventDefault();
return false;
}
})
win.show()
})