diff --git a/src/public/app/widgets/buttons/global_menu.ts b/src/public/app/widgets/buttons/global_menu.ts index 7348a3e9c..9d04c8e56 100644 --- a/src/public/app/widgets/buttons/global_menu.ts +++ b/src/public/app/widgets/buttons/global_menu.ts @@ -133,7 +133,7 @@ const TPL = ` ${t("title_bar_buttons.window-on-top")} - @@ -256,6 +256,7 @@ export default class GlobalMenuWidget extends BasicWidget { private $updateToLatestVersionButton!: JQuery; private $zoomState!: JQuery; + private $toggleZenMode!: JQuery; constructor(isHorizontalLayout: boolean) { super(); @@ -363,13 +364,8 @@ export default class GlobalMenuWidget extends BasicWidget { } this.$zoomState = this.$widget.find(".zoom-state"); - this.$widget.on("show.bs.dropdown", () => { - this.updateZoomState(); - if (this.tooltip) { - this.tooltip.hide(); - this.tooltip.disable(); - } - }); + this.$toggleZenMode = this.$widget.find('[data-trigger-command="toggleZenMode"'); + this.$widget.on("show.bs.dropdown", () => this.#onShown()); if (this.tooltip) { this.$widget.on("hide.bs.dropdown", () => this.tooltip.enable()); } @@ -385,6 +381,15 @@ export default class GlobalMenuWidget extends BasicWidget { setInterval(() => this.updateVersionStatus(), 8 * 60 * 60 * 1000); } + #onShown() { + this.$toggleZenMode.toggleClass("active", $("body").hasClass("zen")); + this.updateZoomState(); + if (this.tooltip) { + this.tooltip.hide(); + this.tooltip.disable(); + } + } + updateZoomState() { if (!utils.isElectron()) { return;