create "disableTray" option

This commit is contained in:
zadam 2022-11-18 21:08:32 +01:00
parent 6cec8bcda8
commit 6f238f5f1a
3 changed files with 9 additions and 1 deletions

View File

@ -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");

View File

@ -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() {

View File

@ -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