Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

desktop: fix desktop integration on mac os

ammarahm-ed736b2a17e9d1
diff --git a/apps/web/desktop/electron.js b/apps/web/desktop/electron.js
index cd036ca08..312e9c705 100644
--- a/apps/web/desktop/electron.js
+++ b/apps/web/desktop/electron.js
@@ -175,12 +175,22 @@ function setupDesktopIntegration() {
globalThis.window.on("close", (e) => {
if (getDesktopIntegration().closeToSystemTray) {
e.preventDefault();
- globalThis.window.minimize();
- globalThis.window.hide();
+ if (process.platform == "darwin") {
+ app.hide();
+ } else {
+ globalThis.window.minimize();
+ globalThis.window.hide();
+ }
}
});
globalThis.window.on("minimize", () => {
- if (getDesktopIntegration().minimizeToSystemTray) globalThis.window.hide();
+ if (getDesktopIntegration().minimizeToSystemTray) {
+ if (process.platform == "darwin") {
+ app.hide();
+ } else {
+ globalThis.window.hide();
+ }
+ }
});
}
diff --git a/apps/web/desktop/jumplist.ts b/apps/web/desktop/jumplist.ts
index 7b773d9a2..ac31b2fd9 100644
--- a/apps/web/desktop/jumplist.ts
+++ b/apps/web/desktop/jumplist.ts
@@ -98,21 +98,6 @@ function setDockMenuOnMacOs() {
sendMessageToRenderer(EVENTS.createItem, { itemType: "reminder" });
}
},
- { type: "separator" },
- {
- label: "Hide",
- type: "normal",
- icon: AssetManager.appIcon({ size: 16 }),
- click: () => app.hide()
- },
- {
- label: "Quit",
- icon: AssetManager.icon("quit", { size: 16 }),
- type: "normal",
- click: () => {
- app.exit(0);
- }
- }
]);
app.dock.setMenu(contextMenu);
}
diff --git a/apps/web/desktop/tray.ts b/apps/web/desktop/tray.ts
index 2cb0cd201..c1cf1b7a2 100644
--- a/apps/web/desktop/tray.ts
+++ b/apps/web/desktop/tray.ts
@@ -27,7 +27,7 @@ let tray: Tray | undefined = undefined;
export function setupTray() {
if (tray) tray.destroy();
- tray = new Tray(AssetManager.appIcon({ size: 32 }));
+ tray = new Tray(AssetManager.appIcon({ size: process.platform === "darwin" ? 24 : 32 }));
const contextMenu = Menu.buildFromTemplate([
{
label: "Show app",
@@ -65,7 +65,7 @@ export function setupTray() {
}
]);
tray.on("double-click", bringToFront);
- tray.on("click", bringToFront);
+ if (process.platform !== "darwin") tray.on("click", bringToFront);
tray.setToolTip("Notesnook");
tray.setContextMenu(contextMenu);
}