A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
desktop: don't show tray menu icons on flatpak builds
Abdullah Attad87b5c53863d
diff --git a/apps/web/desktop/tray.ts b/apps/web/desktop/tray.tsindex 80bd34694..ea5f7b228 100644--- a/apps/web/desktop/tray.ts+++ b/apps/web/desktop/tray.ts@@ -22,12 +22,14 @@ import { AssetManager } from "./asset-manager";import { EVENTS } from "./events";import bringToFront from "./ipc/actions/bringToFront";import { sendMessageToRenderer } from "./ipc/utils";+import { isFlatpak } from "./utils";let tray: Tray | undefined = undefined;export function setupTray() {if (tray) tray.destroy();- const trayIconSize = process.platform === "win32" || process.platform === "darwin" ? 16 : 32;+ const trayIconSize =+ process.platform === "win32" || process.platform === "darwin" ? 16 : 32;tray = new Tray(AssetManager.icon("tray-icon", {@@ -39,14 +41,18 @@ export function setupTray() {{label: "Show app",type: "normal",- icon: AssetManager.icon("tray-icon", { size: trayIconSize }),+ icon: isFlatpak()+ ? undefined+ : AssetManager.icon("tray-icon", { size: trayIconSize }),click: bringToFront},{ type: "separator" },{label: "New note",type: "normal",- icon: AssetManager.icon("note-add", { size: trayIconSize }),+ icon: isFlatpak()+ ? undefined+ : AssetManager.icon("note-add", { size: trayIconSize }),click: () => {bringToFront();sendMessageToRenderer(EVENTS.createItem, { itemType: "note" });@@ -55,7 +61,9 @@ export function setupTray() {{label: "New notebook",type: "normal",- icon: AssetManager.icon("notebook-add", { size: trayIconSize }),+ icon: isFlatpak()+ ? undefined+ : AssetManager.icon("notebook-add", { size: trayIconSize }),click: () => {bringToFront();sendMessageToRenderer(EVENTS.createItem, { itemType: "notebook" });@@ -64,7 +72,9 @@ export function setupTray() {{ type: "separator" },{label: "Quit",- icon: AssetManager.icon("quit", { size: trayIconSize }),+ icon: isFlatpak()+ ? undefined+ : AssetManager.icon("quit", { size: trayIconSize }),type: "normal",click: () => {app.exit(0);diff --git a/apps/web/desktop/utils.js b/apps/web/desktop/utils.jsindex 1c8135354..7aee0990a 100644--- a/apps/web/desktop/utils.js+++ b/apps/web/desktop/utils.js@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.import { app } from "electron";import { join } from "path";-import { statSync } from "fs";+import { statSync, existsSync } from "fs";const APP_ICON_PATH = join(__dirname,@@ -52,4 +52,8 @@ function getPath(filePath) {}}-export { getPath, isDevelopment, APP_ICON_PATH };+function isFlatpak() {+ return existsSync("/.flatpak-info");+}++export { getPath, isDevelopment, isFlatpak, APP_ICON_PATH };