From 6f238f5f1aec7dac83ca1e69441c66e06e220928 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 18 Nov 2022 21:08:32 +0100 Subject: [PATCH] create "disableTray" option --- electron.js | 3 ++- src/services/options_init.js | 1 + src/services/tray.js | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/electron.js b/electron.js index 01f1748ed..5f76269c4 100644 --- a/electron.js +++ b/electron.js @@ -27,7 +27,7 @@ app.on('ready', async () => { // if db is not initialized -> setup process // if db is initialized, then we need to wait until the migration process is finished - if (await sqlInit.isDbInitialized()) { + if (sqlInit.isDbInitialized()) { await sqlInit.dbReady; await windowService.createMainWindow(app); @@ -57,3 +57,4 @@ app.on('will-quit', () => { process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'; require('./src/www'); +const options = require("./src/public/app/services/options.js"); diff --git a/src/services/options_init.js b/src/services/options_init.js index 703e299ab..c7d23e14b 100644 --- a/src/services/options_init.js +++ b/src/services/options_init.js @@ -88,6 +88,7 @@ const defaultOptions = [ { name: 'downloadImagesAutomatically', value: 'true', isSynced: true }, { name: 'minTocHeadings', value: '5', isSynced: true }, { name: 'checkForUpdates', value: 'true', isSynced: true }, + { name: 'disableTray', value: 'false', isSynced: false }, ]; function initStartupOptions() { diff --git a/src/services/tray.js b/src/services/tray.js index 137bf4cef..10f2be279 100644 --- a/src/services/tray.js +++ b/src/services/tray.js @@ -1,6 +1,8 @@ const { Menu, Tray } = require('electron'); const path = require('path'); const windowService = require("./window"); +const optionService = require("./options"); +const options = require("../public/app/services/options.js"); const UPDATE_TRAY_EVENTS = [ 'minimize', 'maximize', 'show', 'hide' @@ -92,6 +94,10 @@ const changeVisibility = () => { } function createTray() { + if (optionService.getOptionBool("disableTray")) { + return; + } + tray = new Tray(getIconPath()); tray.setToolTip('Trilium Notes') // Restore focus