-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
50 lines (38 loc) · 1.08 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
const { app, BrowserWindow, screen, remote, ipcMain, Menu, globalShortcut } = require('electron');
function createWindow() {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
autoHideMenuBar: true,
webPreferences: {
nodeIntegration: true,
backgroundThrottling: false,
}
});
// Load the index.html file
mainWindow.loadFile('index.html');
const template = [
{
label: 'Developer',
submenu: [
{
label: 'Toggle Developer Tools',
accelerator: 'CmdOrCtrl+Shift+I', // Shortcut for opening the inspector
click: () => {
mainWindow.webContents.toggleDevTools();
}
}
]
}
];
// Build menu from template
const menu = Menu.buildFromTemplate(template);
// Set application menu
Menu.setApplicationMenu(menu);
// Register global shortcut for inspector
globalShortcut.register('CmdOrCtrl+Shift+I', () => {
mainWindow.webContents.toggleDevTools();
});
}
app.whenReady().then(createWindow);
app.commandLine.appendSwitch('disable-frame-rate-limit');