Files
hatty/src/renderer/css/app.css
T
zzzjy 2db388c2f2 feat: merge titlebar and tab bar into single header with dynamic workspace alignment
- Merge titlebar and tab bar into a single unified top bar (.titlebar)
- Remove redundant floating workspace button that caused overlap on collapsed sidebar
- Ensure tab bar left aligns with terminal window when workspace sidebar is expanded
- Allow tab bar to sit naturally at leftmost position when workspace sidebar is collapsed
- Update test runner suite to cover merged titlebar and alignment behavior
2026-09-24 22:57:47 +08:00

242 lines
4.8 KiB
CSS

* {
margin: 0;
padding: 0;
box-sizing: border-box;
user-select: none;
}
body {
font-family: var(--font-sans);
background: transparent;
color: var(--text-main);
height: 100vh;
overflow: hidden;
display: flex;
flex-direction: column;
}
#app {
display: flex;
flex-direction: column;
height: 100vh;
background: var(--bg-app);
backdrop-filter: blur(24px) saturate(140%);
-webkit-backdrop-filter: blur(24px) saturate(140%);
border: 1px solid var(--border-color);
border-radius: var(--border-radius-lg);
overflow: hidden;
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
/* 顶部无边框拖拽标题栏 (与标签栏合二为一) */
.titlebar {
height: var(--titlebar-height);
background: var(--bg-titlebar);
display: flex;
align-items: center;
border-bottom: 1px solid var(--border-color);
-webkit-app-region: drag; /* 允许窗口拖拽 */
position: relative;
z-index: 100;
padding: 0;
padding-right: 8px;
box-sizing: border-box;
}
.titlebar-left {
display: flex;
align-items: center;
gap: 6px;
height: 100%;
padding: 0 8px;
width: var(--sidebar-width, 250px);
min-width: var(--sidebar-width, 250px);
max-width: var(--sidebar-width, 250px);
border-right: 1px solid var(--border-color);
-webkit-app-region: no-drag;
overflow: hidden;
box-sizing: border-box;
flex-shrink: 0;
transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1),
min-width 0.22s cubic-bezier(0.4, 0, 0.2, 1),
max-width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
#app.sidebar-collapsed .titlebar-left,
.titlebar-left.sidebar-collapsed {
width: auto;
min-width: 0;
max-width: none;
border-right: none;
padding: 0 8px;
}
.app-brand {
display: flex;
align-items: center;
gap: 6px;
font-size: 13px;
font-weight: 700;
color: var(--accent-color);
padding: 0 4px;
letter-spacing: 0.5px;
-webkit-app-region: drag;
cursor: grab;
flex-shrink: 0;
}
/* 顶部标题栏工作区标识 */
.titlebar-workspace-tag {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 2px 8px;
height: 22px;
background: var(--bg-tab-inactive);
border: 1px solid var(--border-color);
border-radius: 12px;
font-size: 11px;
color: var(--text-muted);
white-space: nowrap;
user-select: none;
-webkit-app-region: no-drag !important;
transition: all 0.15s ease;
flex-shrink: 1;
min-width: 0;
overflow: hidden;
}
.titlebar-workspace-tag:hover {
background: var(--bg-tab-hover);
color: var(--text-main);
border-color: var(--border-active);
}
.ws-tag-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent-color);
box-shadow: 0 0 6px var(--accent-glow);
flex-shrink: 0;
}
.ws-tag-name {
font-weight: 500;
max-width: 95px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* 标签页栏容器 (位于顶栏中央,工作区展开时与终端左侧像素对齐) */
.tab-bar-container {
display: flex;
align-items: center;
gap: 4px;
min-width: 0;
max-width: calc(100vw - 360px);
padding: 0;
height: 100%;
-webkit-app-region: no-drag !important;
box-sizing: border-box;
}
.titlebar-drag-spacer {
flex: 1;
height: 100%;
-webkit-app-region: drag; /* 中间大面积空白区域允许拖拽 */
cursor: grab;
min-width: 20px;
}
.app-brand-icon {
width: 14px;
height: 14px;
}
.titlebar-actions {
display: flex;
align-items: center;
gap: 4px;
-webkit-app-region: no-drag;
}
.btn-icon {
background: transparent;
border: none;
color: var(--text-muted);
width: 28px;
height: 28px;
border-radius: var(--border-radius-sm);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.15s ease;
-webkit-app-region: no-drag !important;
flex-shrink: 0;
}
.btn-icon svg,
.btn-icon svg * {
pointer-events: none !important;
}
.btn-icon:hover {
background: var(--btn-hover, rgba(255, 255, 255, 0.08));
color: var(--text-bright);
}
.btn-icon:active {
transform: scale(0.95);
}
/* 窗口控制按钮 (最小化、最大化、关闭) */
.window-controls {
display: flex;
align-items: center;
gap: 2px;
margin-left: 6px;
-webkit-app-region: no-drag !important;
}
.win-btn {
background: transparent;
border: none;
color: var(--text-muted);
width: 32px;
height: 28px;
border-radius: var(--border-radius-sm);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.15s ease;
-webkit-app-region: no-drag !important;
}
.win-btn svg,
.win-btn svg * {
pointer-events: none !important;
}
.win-btn:hover {
background: var(--btn-hover, rgba(255, 255, 255, 0.08));
color: var(--text-bright);
}
.win-btn.close:hover {
background: #f7768e;
color: #ffffff;
}
/* 主内容区终端视口 */
.main-viewport {
flex: 1;
min-height: 0;
position: relative;
overflow: hidden;
background: transparent;
}