Skip to content

Build your personal knowledge base with Trilium Notes

create "disableTray" option

zadam6f238f5f1aec
diff --git a/electron.js b/electron.js
index 01f1748ed1..5f76269c41 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 703e299ab3..c7d23e14b4 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 137bf4cefe..10f2be2798 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