refactor: extract titlebar menu to preload script

This commit is contained in:
4gray committed 2022-01-03 16:03:55 +01:00
1 parent 1aefcf3477
commit bf8664bec5
6 files changed
+1009 -1370

No files matched your search

+1
View File
@@ -16,6 +16,7 @@ src/**/*.js
!src/karma.conf.js
*.js.map
data.db
preload.js
# dependencies
/node_modules
+1
View File
@@ -17,6 +17,7 @@ function createWindow(): BrowserWindow {
width: 1000,
height: 800,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
nodeIntegration: true,
allowRunningInsecureContent: serve ? true : false,
contextIsolation: false,
-12
View File
@@ -1,4 +1,3 @@
import { Color, Titlebar } from 'custom-electron-titlebar';
import { app, BrowserWindow, Menu, MenuItem, shell } from 'electron';
import * as path from 'path';
import {
@@ -18,7 +17,6 @@ export class AppMenu {
constructor(appWindow: BrowserWindow) {
this.window = appWindow;
this.initMenu();
this.initTitleBar();
}
/**
@@ -36,16 +34,6 @@ export class AppMenu {
this.menu.append(this.getHelpMenu());
}
initTitleBar() {
if (process.platform !== 'darwin') {
new Titlebar({
backgroundColor: Color.fromHex('#000'),
itemBackgroundColor: Color.fromHex('#222'),
enableMnemonics: true,
});
}
}
/**
* Return the application menu
*/
+996 -1357
View File
File diff suppressed because it is too large. Load diff
+9
View File
@@ -0,0 +1,9 @@
import { Color, Titlebar } from 'custom-electron-titlebar';
window.addEventListener('DOMContentLoaded', () => {
new Titlebar({
backgroundColor: Color.fromHex('#000'),
itemBackgroundColor: Color.fromHex('#222'),
enableMnemonics: true,
});
});
+2 -1
View File
@@ -20,7 +20,8 @@
"api.ts",
"epg-worker.ts",
"main.ts",
"menu.ts"
"menu.ts",
"preload.ts"
],
"exclude": [
"node_modules",