-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (30 loc) · 836 Bytes
/
index.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
// TODO: Make typescript
const { app, BrowserWindow, ipcMain, Menu, nativeTheme } = require('electron');
const url = require('url');
const path = require('path');
let menuVisibility = true;
let menuState = Menu.getApplicationMenu();
console.log(menuState);
function onReady() {
win = new BrowserWindow({
width: 900,
height: 670,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
win.loadURL('http://localhost:4200');
nativeTheme.themeSource = 'dark';
ipcMain.on('toggle-menu', () => {
menuVisibility = !menuVisibility;
if (menuVisibility) {
menuState = Menu.getApplicationMenu();
Menu.setApplicationMenu(null);
} else {
Menu.setApplicationMenu(menuState);
}
console.log('menuState after', menuState);
});
}
app.on('ready', onReady);