-
Notifications
You must be signed in to change notification settings - Fork 25
/
main.js
49 lines (41 loc) · 1.12 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
/**
* Webian Shell.
*
* Main script which loads shell.html as chrome.
*/
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const Menu = electron.Menu;
const path = require('path');
const url = require('url');
let mainWindow;
function startShell () {
// Create the main window
mainWindow = new BrowserWindow({
fullscreen: true,
webPreferences: {
nodeIntegration: true,
webviewTag: true
}
});
// Workaround for https://github.com/electron/electron/issues/21259
Menu.setApplicationMenu(null);
// Load shell.html as chrome
mainWindow.loadURL(url.format({
pathname: path.join(__dirname, 'chrome/desktop/shell.html'),
protocol: 'file:',
slashes: true
}));
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object
mainWindow = null;
// Quit Electron
app.quit();
});
// Uncomment the following line to open developer tools for the main window
//mainWindow.webContents.openDevTools();
};
// Start Shell when Electron is ready
app.on('ready', startShell);