-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
53 lines (45 loc) · 1.15 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
const electron = require('electron')
const globalShortcut = electron.globalShortcut
const app = electron.app
const BrowserWindow = electron.BrowserWindow
let mainWindow
function createWindow() {
// Création d'une fenetre en résolution 1133x720
mainWindow = new BrowserWindow({
width: 1020,
height: 640,
frame: false,
icon: __dirname + '/src/assets/icons/logo.png',
resizable: false,
fullscreenable: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
},
})
mainWindow.loadFile(`${__dirname}/src/index.html`)
// Open the DevTools.
mainWindow.webContents.openDevTools()
mainWindow.on('closed', function () {
mainWindow = null
})
globalShortcut.register('f5', function() {
console.log('f5 is pressed')
mainWindow.reload()
})
globalShortcut.register('CommandOrControl+R', function() {
console.log('CommandOrControl+R is pressed')
mainWindow.reload()
})
}
app.on('ready', createWindow)
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
if (mainWindow === null) {
createWindow()
}
})