2025-02-14 18:18:28 +02:00
|
|
|
import BasicWidget from "./basic_widget.js";
|
2025-02-22 16:12:12 +01:00
|
|
|
import { t } from "../services/i18n.js";
|
2025-02-14 18:18:28 +02:00
|
|
|
|
|
|
|
const TPL = `\
|
|
|
|
<div class="close-zen-container">
|
2025-02-14 18:47:15 +02:00
|
|
|
<button class="button-widget bx icon-action bxs-yin-yang"
|
2025-02-22 16:12:12 +01:00
|
|
|
data-trigger-command="toggleZenMode"
|
|
|
|
title="${t("zen_mode.button_exit")}"
|
|
|
|
/>
|
2025-02-14 18:18:28 +02:00
|
|
|
|
|
|
|
<style>
|
2025-02-14 18:47:15 +02:00
|
|
|
:root {
|
|
|
|
--zen-button-size: 32px;
|
|
|
|
}
|
|
|
|
|
2025-02-14 18:18:28 +02:00
|
|
|
.close-zen-container {
|
|
|
|
display: none;
|
2025-02-14 19:07:13 +02:00
|
|
|
width: var(--zen-button-size);
|
|
|
|
height: var(--zen-button-size);
|
2025-02-14 18:18:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
body.zen .close-zen-container {
|
|
|
|
display: block;
|
|
|
|
position: fixed;
|
2025-02-14 18:56:36 +02:00
|
|
|
top: 2px;
|
|
|
|
right: 2px;
|
2025-02-14 18:18:28 +02:00
|
|
|
z-index: 9999;
|
2025-02-14 18:47:15 +02:00
|
|
|
-webkit-app-region: no-drag;
|
2025-02-14 18:18:28 +02:00
|
|
|
}
|
|
|
|
|
2025-02-16 15:38:31 +02:00
|
|
|
body.zen.electron:not(.platform-darwin):not(.native-titlebar) .close-zen-container {
|
2025-02-14 19:07:13 +02:00
|
|
|
left: calc(env(titlebar-area-width) - var(--zen-button-size) - 2px);
|
2025-02-14 18:18:28 +02:00
|
|
|
right: unset;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</div>
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default class CloseZenButton extends BasicWidget {
|
|
|
|
|
|
|
|
doRender(): void {
|
|
|
|
this.$widget = $(TPL);
|
|
|
|
}
|
|
|
|
|
|
|
|
zenChangedEvent() {
|
|
|
|
this.toggleInt(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|