Skip to content

Commit

Permalink
Merge pull request #2822 from opossum-tool/feat/macos-menu
Browse files Browse the repository at this point in the history
Change menu structure on MacOS
  • Loading branch information
PhilippMa authored Feb 27, 2025
2 parents 988f4fb + 9fa231f commit 3de5545
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "opossum-ui",
"productName": "OpossumUI",
"description": "The OpossumUI enables the editing of attribution information that is assigned to a resource tree.",
"license": "Apache-2.0",
"version": "0.1.0",
Expand Down
4 changes: 3 additions & 1 deletion src/ElectronBackend/main/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
// SPDX-FileCopyrightText: Nico Carl <[email protected]>
//
// SPDX-License-Identifier: Apache-2.0
import { BrowserWindow, Menu } from 'electron';
import { BrowserWindow, Menu, MenuItem } from 'electron';
import os from 'os';

import { getAboutMenu } from './menu/aboutMenu';
import { getEditMenu } from './menu/editMenu';
Expand All @@ -15,6 +16,7 @@ export async function createMenu(mainWindow: BrowserWindow): Promise<Menu> {
const webContents = mainWindow.webContents;

return Menu.buildFromTemplate([
...(os.platform() === 'darwin' ? [{ role: 'appMenu' } as MenuItem] : []),
getFileMenu(mainWindow),
getEditMenu(webContents),
await getViewMenu(),
Expand Down
3 changes: 2 additions & 1 deletion src/ElectronBackend/main/menu/fileMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//
// SPDX-License-Identifier: Apache-2.0
import { app, BrowserWindow } from 'electron';
import os from 'os';

import { AllowedFrontendChannels } from '../../../shared/ipc-channels';
import {
Expand Down Expand Up @@ -278,7 +279,7 @@ export function getFileMenu(mainWindow: BrowserWindow) {
getProjectMetadata(webContents),
getProjectStatistics(webContents),
getSetBaseUrl(mainWindow),
getQuit(),
...(os.platform() === 'darwin' ? [] : [getQuit()]),
],
};
}

0 comments on commit 3de5545

Please sign in to comment.