Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Mollify TypeScript

Manav Rathi1bb79854a556
diff --git a/desktop/src/main/menu.ts b/desktop/src/main/menu.ts
index ddaacf32da..6589329611 100644
--- a/desktop/src/main/menu.ts
+++ b/desktop/src/main/menu.ts
@@ -16,8 +16,6 @@ import { openLogDirectory } from "./util";
/** Create and return the entries in the app's main menu bar */
export const createApplicationMenu = async (mainWindow: BrowserWindow) => {
- const isMac = process.platform == "darwin";
-
// The state of checkboxes
//
// Whenever the menu is redrawn the current value of these variables is used
@@ -25,6 +23,9 @@ export const createApplicationMenu = async (mainWindow: BrowserWindow) => {
let isAutoLaunchEnabled = await autoLauncher.isEnabled();
let shouldHideDockIcon = getHideDockIconPreference();
+ const macOSOnly = (options: MenuItemConstructorOptions[]) =>
+ process.platform == "darwin" ? options : [];
+
const handleCheckForUpdates = () =>
forceCheckForUpdateAndNotify(mainWindow);
@@ -55,14 +56,12 @@ export const createApplicationMenu = async (mainWindow: BrowserWindow) => {
{
label: "ente",
submenu: [
- ...((isMac
- ? [
- {
- label: "About Ente",
- role: "about",
- },
- ]
- : []) as MenuItemConstructorOptions[]),
+ ...macOSOnly([
+ {
+ label: "About Ente",
+ role: "about",
+ },
+ ]),
{ type: "separator" },
{
label: "Check for Updates...",
@@ -93,20 +92,17 @@ export const createApplicationMenu = async (mainWindow: BrowserWindow) => {
},
{ type: "separator" },
- ...((isMac
- ? [
- {
- label: "Hide Ente",
- role: "hide",
- },
- {
- label: "Hide Others",
- role: "hideOthers",
- },
- ]
- : []) as MenuItemConstructorOptions[]),
-
- { type: "separator" },
+ ...macOSOnly([
+ {
+ label: "Hide Ente",
+ role: "hide",
+ },
+ {
+ label: "Hide Others",
+ role: "hideOthers",
+ },
+ { type: "separator" },
+ ]),
{
label: "Quit",
role: "quit",
@@ -123,24 +119,22 @@ export const createApplicationMenu = async (mainWindow: BrowserWindow) => {
{ label: "Copy", role: "copy" },
{ label: "Paste", role: "paste" },
{ label: "Select All", role: "selectAll" },
- ...((isMac
- ? [
- { type: "separator" },
- {
- label: "Speech",
- submenu: [
- {
- role: "startSpeaking",
- label: "start speaking",
- },
- {
- role: "stopSpeaking",
- label: "stop speaking",
- },
- ],
- },
- ]
- : []) as MenuItemConstructorOptions[]),
+ ...macOSOnly([
+ { type: "separator" },
+ {
+ label: "Speech",
+ submenu: [
+ {
+ role: "startSpeaking",
+ label: "start speaking",
+ },
+ {
+ role: "stopSpeaking",
+ label: "stop speaking",
+ },
+ ],
+ },
+ ]),
],
},
{
@@ -158,14 +152,12 @@ export const createApplicationMenu = async (mainWindow: BrowserWindow) => {
{ label: "Minimize", role: "minimize" },
{ label: "Zoom", role: "zoom" },
{ label: "Close", role: "close" },
- ...((isMac
- ? [
- { type: "separator" },
- { label: "Bring All to Front", role: "front" },
- { type: "separator" },
- { label: "Ente", role: "window" },
- ]
- : []) as MenuItemConstructorOptions[]),
+ ...macOSOnly([
+ { type: "separator" },
+ { label: "Bring All to Front", role: "front" },
+ { type: "separator" },
+ { label: "Ente", role: "window" },
+ ]),
],
},
{