MCPcopy
hub / github.com/nilbuild/pennywise / createWindow

Function createWindow

public/electron.js:29–83  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29function createWindow() {
30 mainWindow = new BrowserWindow({
31 title: 'Pennywise',
32 width: 700,
33 height: 600,
34 autoHideMenuBar: true,
35 backgroundColor: '#16171a',
36 show: false,
37 frame: argv.frameless ? false : true,
38 webPreferences: {
39 plugins: true,
40 nodeIntegration: true,
41 webviewTag: true
42 },
43 });
44
45 pdfWindow.addSupport(mainWindow);
46
47 const isDev = !!process.env.APP_URL;
48 if (process.env.APP_URL) {
49 mainWindow.loadURL(process.env.APP_URL);
50 } else {
51 mainWindow.loadFile(path.join(__dirname, '../build/index.html'));
52 }
53
54 // Show the window once the content has been loaded
55 mainWindow.on('ready-to-show', () => {
56 // Hide the dock icon before showing and
57 // show it once the app has been displayed
58 // @link https://github.com/electron/electron/issues/10078
59 // @fixme hack to make it show on full-screen windows
60 app.dock && app.dock.hide();
61 mainWindow.show();
62 app.dock && app.dock.show();
63
64 // Set the window to be always on top
65 mainWindow.setAlwaysOnTop(true);
66 mainWindow.setVisibleOnAllWorkspaces(true);
67 mainWindow.setFullScreenable(false);
68
69 bindIpc();
70 });
71
72 mainWindow.on('closed', function () {
73 mainWindow = null;
74 });
75
76 // Open the dev tools only for dev
77 // and when the flag is not set
78 if (isDev && !process.env.DEV_TOOLS) {
79 mainWindow.webContents.openDevTools();
80 }
81
82 setMainMenu(mainWindow);
83}
84
85// Binds the methods for renderer/electron communication
86function bindIpc() {

Callers 1

electron.jsFile · 0.85

Calls 2

bindIpcFunction · 0.85
setMainMenuFunction · 0.85

Tested by

no test coverage detected