fix: titlebar dragging area and add double-click to maximize

This commit is contained in:
2026-09-23 00:12:18 +08:00
parent c58c319805
commit cbc953948c
4 changed files with 23 additions and 2 deletions
+11 -2
View File
@@ -46,9 +46,8 @@ body {
display: flex;
align-items: center;
gap: 8px;
flex: 1;
overflow: hidden;
-webkit-app-region: no-drag;
-webkit-app-region: drag; /* 允许左侧空白和品牌区域拖拽 */
}
.app-brand {
@@ -60,6 +59,16 @@ body {
color: var(--accent-color);
padding: 0 8px;
letter-spacing: 0.5px;
-webkit-app-region: drag;
cursor: grab;
}
.titlebar-drag-spacer {
flex: 1;
height: 100%;
-webkit-app-region: drag; /* 中间大面积空白区域允许拖拽 */
cursor: grab;
min-width: 40px;
}
.app-brand-icon {
+1
View File
@@ -6,6 +6,7 @@
overflow-x: auto;
scrollbar-width: none;
max-width: calc(100vw - 320px);
-webkit-app-region: no-drag;
}
.tab-bar::-webkit-scrollbar {
+3
View File
@@ -37,6 +37,9 @@
</button>
</div>
<!-- 中间空白可拖拽区域 -->
<div class="titlebar-drag-spacer" id="titlebar-drag-spacer"></div>
<!-- 右侧快速操作按钮与窗口控制 -->
<div class="titlebar-actions">
<button class="btn-icon" id="btn-split-h" title="向右水平分屏 (Ctrl+Shift+E)">
+8
View File
@@ -169,6 +169,14 @@ class TerminalApp {
document.getElementById('win-close')?.addEventListener('click', () => {
window.terminalAPI.close();
});
// 双击标题栏空白处最大化/还原
document.getElementById('titlebar-drag-spacer')?.addEventListener('dblclick', () => {
window.terminalAPI.maximize();
});
document.querySelector('.app-brand')?.addEventListener('dblclick', () => {
window.terminalAPI.maximize();
});
}
initIpcListeners() {