Skip to content

Build your personal knowledge base with Trilium Notes

added option to disable tray, closes #2612

zadam02d908df1e0a
diff --git a/src/public/app/widgets/dialogs/options/backup.js b/src/public/app/widgets/dialogs/options/backup.js
index b5cd879397..ac24da58b1 100644
--- a/src/public/app/widgets/dialogs/options/backup.js
+++ b/src/public/app/widgets/dialogs/options/backup.js
@@ -50,21 +50,21 @@ export default class BackupOptions {
this.$dailyBackupEnabled.on('change', () => {
const opts = { 'dailyBackupEnabled': this.$dailyBackupEnabled.is(":checked") ? "true" : "false" };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
this.$weeklyBackupEnabled.on('change', () => {
const opts = { 'weeklyBackupEnabled': this.$weeklyBackupEnabled.is(":checked") ? "true" : "false" };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
this.$monthlyBackupEnabled.on('change', () => {
const opts = { 'monthlyBackupEnabled': this.$monthlyBackupEnabled.is(":checked") ? "true" : "false" };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
diff --git a/src/public/app/widgets/dialogs/options/code_notes.js b/src/public/app/widgets/dialogs/options/code_notes.js
index 335c8b9229..be4079ee54 100644
--- a/src/public/app/widgets/dialogs/options/code_notes.js
+++ b/src/public/app/widgets/dialogs/options/code_notes.js
@@ -61,7 +61,7 @@ export default class CodeNotesOptions {
this.$autoReadonlySizeCode = $("#auto-readonly-size-code");
this.$autoReadonlySizeCode.on('change', () => {
const opts = { 'autoReadonlySizeCode': this.$autoReadonlySizeCode.val() };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
diff --git a/src/public/app/widgets/dialogs/options/images.js b/src/public/app/widgets/dialogs/options/images.js
index 699d6c06d3..8965bf9f12 100644
--- a/src/public/app/widgets/dialogs/options/images.js
+++ b/src/public/app/widgets/dialogs/options/images.js
@@ -39,14 +39,14 @@ export default class ImageOptions {
this.$imageMaxWidthHeight.on('change', () => {
const opts = { 'imageMaxWidthHeight': this.$imageMaxWidthHeight.val() };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
this.$imageJpegQuality.on('change', () => {
const opts = { 'imageJpegQuality': this.$imageJpegQuality.val() };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
@@ -57,7 +57,7 @@ export default class ImageOptions {
const isChecked = this.$downloadImagesAutomatically.prop("checked");
const opts = { 'downloadImagesAutomatically': isChecked ? 'true' : 'false' };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
});
this.$enableImageCompression = $("#image-compresion-enabled");
@@ -75,7 +75,7 @@ export default class ImageOptions {
const isChecked = this.$enableImageCompression.prop("checked");
const opts = { 'compressImages': isChecked ? 'true' : 'false' };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
this.setImageCompression(isChecked);
});
diff --git a/src/public/app/widgets/dialogs/options/other.js b/src/public/app/widgets/dialogs/options/other.js
index 6f4a8919df..1ba16369d0 100644
--- a/src/public/app/widgets/dialogs/options/other.js
+++ b/src/public/app/widgets/dialogs/options/other.js
@@ -1,8 +1,17 @@
-import utils from "../../../services/utils.js";
import server from "../../../services/server.js";
import toastService from "../../../services/toast.js";
const TPL = `
+<div>
+ <h4>Tray</h4>
+
+ <div class="custom-control custom-checkbox">
+ <input type="checkbox" class="custom-control-input" id="tray-enabled">
+ <label class="custom-control-label" for="tray-enabled">Enable tray (Trilium needs to be restarted for this change to take effect)</label>
+ </div>
+ <br/>
+</div>
+
<div>
<h4>Note erasure timeout</h4>
@@ -35,27 +44,33 @@ const TPL = `
</div>
<div>
-<h4>Network connections</h4>
-
-<div class="form-group">
- <input id="check-for-updates" type="checkbox" name="check-for-updates">
- <label for="check-for-updates">Check for updates automatically</label>
-</div>
-</div>
-
-`;
+ <h4>Network connections</h4>
+
+ <div class="form-group">
+ <input id="check-for-updates" type="checkbox" name="check-for-updates">
+ <label for="check-for-updates">Check for updates automatically</label>
+ </div>
+</div>`;
export default class OtherOptions {
constructor() {
$("#options-other").html(TPL);
+ this.$trayEnabled = $("#tray-enabled");
+ this.$trayEnabled.on('change', () => {
+ const opts = { 'disableTray': !this.$trayEnabled.is(":checked") ? "true" : "false" };
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
+
+ return false;
+ });
+
this.$eraseEntitiesAfterTimeInSeconds = $("#erase-entities-after-time-in-seconds");
this.$eraseEntitiesAfterTimeInSeconds.on('change', () => {
const eraseEntitiesAfterTimeInSeconds = this.$eraseEntitiesAfterTimeInSeconds.val();
server.put('options', { 'eraseEntitiesAfterTimeInSeconds': eraseEntitiesAfterTimeInSeconds }).then(() => {
- toastService.showMessage("Options changed have been saved.");
+ toastService.showMessage("Options change have been saved.");
});
return false;
@@ -72,7 +87,7 @@ export default class OtherOptions {
this.$noteRevisionsTimeInterval.on('change', () => {
const opts = { 'noteRevisionSnapshotTimeInterval': this.$noteRevisionsTimeInterval.val() };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
@@ -82,11 +97,13 @@ export default class OtherOptions {
const isChecked = this.$checkForUpdates.prop("checked");
const opts = { 'checkForUpdates': isChecked ? 'true' : 'false' };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
});
}
optionsLoaded(options) {
+ this.$trayEnabled.prop("checked", options['disableTray'] !== 'true');
+
this.$eraseEntitiesAfterTimeInSeconds.val(options['eraseEntitiesAfterTimeInSeconds']);
this.$noteRevisionsTimeInterval.val(options['noteRevisionSnapshotTimeInterval']);
diff --git a/src/public/app/widgets/dialogs/options/password.js b/src/public/app/widgets/dialogs/options/password.js
index 31816344b3..82c9b0cf6b 100644
--- a/src/public/app/widgets/dialogs/options/password.js
+++ b/src/public/app/widgets/dialogs/options/password.js
@@ -77,7 +77,7 @@ export default class PasswordOptions {
const protectedSessionTimeout = this.$protectedSessionTimeout.val();
server.put('options', { 'protectedSessionTimeout': protectedSessionTimeout }).then(() => {
- toastService.showMessage("Options changed have been saved.");
+ toastService.showMessage("Options change have been saved.");
});
return false;
diff --git a/src/public/app/widgets/dialogs/options/spellcheck.js b/src/public/app/widgets/dialogs/options/spellcheck.js
index cba354f5ad..5e4db38388 100644
--- a/src/public/app/widgets/dialogs/options/spellcheck.js
+++ b/src/public/app/widgets/dialogs/options/spellcheck.js
@@ -41,14 +41,14 @@ export default class SpellcheckOptions {
this.$spellCheckEnabled.on('change', () => {
const opts = { 'spellCheckEnabled': this.$spellCheckEnabled.is(":checked") ? "true" : "false" };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
this.$spellCheckLanguageCode.on('change', () => {
const opts = { 'spellCheckLanguageCode': this.$spellCheckLanguageCode.val() };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
diff --git a/src/public/app/widgets/dialogs/options/sync.js b/src/public/app/widgets/dialogs/options/sync.js
index af3dc7838d..fa2122ce34 100644
--- a/src/public/app/widgets/dialogs/options/sync.js
+++ b/src/public/app/widgets/dialogs/options/sync.js
@@ -74,7 +74,7 @@ export default class SyncOptions {
'syncProxy': this.$syncProxy.val()
};
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
}
diff --git a/src/public/app/widgets/dialogs/options/text_notes.js b/src/public/app/widgets/dialogs/options/text_notes.js
index 524208ab20..64ca1f1be9 100644
--- a/src/public/app/widgets/dialogs/options/text_notes.js
+++ b/src/public/app/widgets/dialogs/options/text_notes.js
@@ -62,7 +62,7 @@ export default class TextNotesOptions {
this.$autoReadonlySizeText.on('change', () => {
const opts = { 'autoReadonlySizeText': this.$autoReadonlySizeText.val() };
- server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
+ server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
return false;
});
diff --git a/src/routes/api/options.js b/src/routes/api/options.js
index 07def4479f..e8e7bfe085 100644
--- a/src/routes/api/options.js
+++ b/src/routes/api/options.js
@@ -59,7 +59,8 @@ const ALLOWED_OPTIONS = new Set([
'compressImages',
'downloadImagesAutomatically',
'minTocHeadings',
- 'checkForUpdates'
+ 'checkForUpdates',
+ 'disableTray'
]);
function getOptions() {