Disable top menu bar completely

Closes #1031
This commit is contained in:
Lenny Angst
2025-07-25 22:23:39 +02:00
parent 8cc4448d09
commit 0ff01b1d01
2 changed files with 3 additions and 17 deletions
+1 -6
View File
@@ -16,14 +16,10 @@ import { ElectronCapacitorApp, setupContentSecurityPolicy, setupReloadWatcher }
// Graceful handling of unhandled errors.
unhandled();
// Define our menu templates (these are optional)
// Define our menu template (this is optional)
const trayMenuTemplate: (MenuItemConstructorOptions | MenuItem)[] = [
new MenuItem({ label: 'Quit App', role: 'quit' })
];
const appMenuBarMenuTemplate: (MenuItemConstructorOptions | MenuItem)[] = [
{ role: process.platform === 'darwin' ? 'appMenu' : 'fileMenu' },
{ role: 'viewMenu' }
];
// Get Config options from capacitor.config
const capacitorFileConfig: CapacitorElectronConfig = getCapacitorElectronConfig();
@@ -33,7 +29,6 @@ const capacitorFileConfig: CapacitorElectronConfig = getCapacitorElectronConfig(
const myCapacitorApp = new ElectronCapacitorApp(
capacitorFileConfig,
trayMenuTemplate,
appMenuBarMenuTemplate
);
// If deeplinking is enabled then we will set it up here.
+2 -11
View File
@@ -52,10 +52,6 @@ export class ElectronCapacitorApp {
private TrayMenuTemplate: (MenuItem | MenuItemConstructorOptions)[] = [
new MenuItem({ label: 'Quit App', role: 'quit' }),
];
private AppMenuBarMenuTemplate: (MenuItem | MenuItemConstructorOptions)[] = [
{ role: process.platform === 'darwin' ? 'appMenu' : 'fileMenu' },
{ role: 'viewMenu' },
];
private mainWindowState;
private loadWebApp;
private customScheme: string;
@@ -63,7 +59,6 @@ export class ElectronCapacitorApp {
constructor(
capacitorFileConfig: CapacitorElectronConfig,
trayMenuTemplate?: (MenuItemConstructorOptions | MenuItem)[],
appMenuBarMenuTemplate?: (MenuItemConstructorOptions | MenuItem)[]
) {
this.CapacitorFileConfig = capacitorFileConfig;
@@ -73,10 +68,6 @@ export class ElectronCapacitorApp {
this.TrayMenuTemplate = trayMenuTemplate;
}
if (appMenuBarMenuTemplate) {
this.AppMenuBarMenuTemplate = appMenuBarMenuTemplate;
}
// Setup our web app loader, this lets us load apps like react, vue, and angular without changing their build chains.
this.loadWebApp = electronServe({
directory: join(app.getAppPath(), 'app'),
@@ -164,8 +155,8 @@ export class ElectronCapacitorApp {
this.TrayIcon.setContextMenu(Menu.buildFromTemplate(this.TrayMenuTemplate));
}
// Setup the main manu bar at the top of our window.
Menu.setApplicationMenu(Menu.buildFromTemplate(this.AppMenuBarMenuTemplate));
// Disable Menu Bar at the top.
Menu.setApplicationMenu(null);
// If the splashscreen is enabled, show it first while the main window loads then switch it out for the main window, or just load the main window from the start.
if (this.CapacitorFileConfig.electron?.splashScreenEnabled) {