All your AI agent sessions in one place — browse, search, resume. Rust + GPUI.
Rust
feat(ui): zoom the whole interface to 110%, 125% or 150% (#51)
Corey Chiu8862859ddf7f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a940630..cb9c4f2 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,7 @@- New: Kilo Code sessions are indexed — from the database the VS Code extension, the `kilo` CLI and the JetBrains plugin share (`~/.local/share/kilo/kilo.db`, read-only), and from the legacy extension's task folders in VS Code and other VS Code-based editors. Titles, models, thinking, tool calls and token counts included; legacy sub-tasks are listed under the task that started them, and a legacy task the new extension has imported is listed once. Open In continues a session with `kilo --session` in its project directory (legacy tasks have no Open In). On remote hosts only the legacy tasks are mirrored, since `kilo.db` also holds Kilo's credentials (#59, thanks @ICEY4040727)- Fix: OpenCode sessions show the slash command that started a sub-agent instead of an empty message, and on Windows they are grouped under the same project as other agents' sessions+- New: Enlarge the whole interface to 110%, 125% or 150% with ⌘+ / ⌘− / ⌘0 (Ctrl on Linux and Windows), the new View menu, or the new Settings → Appearance page, which also takes over the light / dark choice from General; the level is remembered (#51, thanks @kyomind)## [0.8.6] — 2026-10-01diff --git a/DESIGN.md b/DESIGN.mdindex 07c8d75..d737831 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -266,12 +266,23 @@ emoji 不再承担界面或正文结构图标职责。- 双模式使用同一语义结构,只有 token 值变化。- 最小窗口宽度必须保证标题、主操作和更多菜单不互相挤压。+### 界面缩放(2026-10-08,issue #51)++- 档位 100 / 110 / 125 / 150%,默认 100,只放大不缩小(用户 2026-10-08 定,去掉了 90 与 175);⌘+ / ⌘− / ⌘0(其他平台 Ctrl)、显示菜单的 Zoom In / Zoom Out / Actual Size、Settings → Appearance 的 Zoom 是同一个设置,两扇窗一起变。Appearance 是独立的设置页(Theme + Zoom 两行;主题行叫 Theme,页才叫 Appearance),不放 General(用户同日定)。快捷键在任何焦点下都有效(弹窗里、下拉刚关、设置窗在前);到头时什么也不做。+- **整体等比放大**:字号、间距、圆角、图标、行高、栏宽都乘同一个倍数——100% 档的设计稿就是唯一的设计,本文所有尺寸都指 100% 档。只有三类不跟着放大:1px 发丝线、窗口尺寸(最小尺寸 940×620 只在开窗时定)、traffic lights 本身的大小。+- traffic lights 跟着挪位:红灯中心压在放大后的侧栏中轴(26.75 × 倍数)上、在放大后的顶部净空里垂直居中——放大后的界面与 100% 档同构,中轴关系不变。+- 窗口不够宽时两条定宽栏(侧栏、会话流)按比例收窄,给阅读区留 380,最窄退回 100% 档的宽度;设置窗的侧栏同理给内容区留 540。弹窗宽度与 ⌘K 面板高度夹在窗口之内。窄栏里放不下的内容一律截断(头部徽章、侧栏 agent 名),不允许互相压盖。+- 换档时对话流与 Memory 列表按比例重量行高,阅读位置不跳。+- 设置窗不随档位改变自己的大小(开着时换档,150% 下 820×600 只够放 100% 的三分之二内容),所以设置卡片放不下时**右侧控件换到标题下一行**、标题列至少 180;设置各页(General / Appearance / Data / Connect / Updates 走同一个页骨架)与设置侧栏都可滚动。Insights 的概览大数字放不下就换行;热力图与趋势图共用的周格在栏宽放不下 53 周时等比收窄格子(标签列不缩),一年始终完整、两图周列仍对齐。+## 实现守则+- 尺寸一律经 `ui::Zpx`(常量)/ `ui::zpx(…)`(表达式)取值,不要再写裸 `px(…)`——裸 px 不会跟着缩放;只有 1px 发丝线、零值、已按倍数算好的实际宽度与测试例外。`ui.rs` 的 `bare_pixel_sizes_do_not_creep_back` 按文件卡裸 px 的个数,只许减不许增。+- 先改标准结构和控件,再添加自定义材质面。- 颜色只改 `theme.rs`;图标必须登记到 `assets.rs`,路径包含后缀(`.svg` / `.png`,漏后缀 = 静默空白)。- 所有交互元素先设置 `.id()` 再绑定点击或滚动行为。-- 每个窗口根节点在内容之后必须挂 `ui::overlay_layers(window, cx)`(封装 `Root::render_dialog_layer`、`Root::render_notification_layer` 与"点面板外关闭"的 sentinel,顺序即契约);普通弹窗经 `ui::open_closable_dialog` 打开,确认类用 `open_alert_dialog`。+- 每个窗口根节点在内容之后必须挂 `ui::overlay_layers(window, cx)`(封装 `Root::render_dialog_layer`、`Root::render_notification_layer` 与"点面板外关闭"的 sentinel,顺序即契约);普通弹窗经 `ui::open_closable_dialog` 打开,确认类用 `ui::open_alert`(两者都收设计稿宽度:随缩放放大、夹进窗口,内边距也随缩放;不要裸调 `window.open_dialog` / `open_alert_dialog`)。- 对原始 Agent 数据目录继续只读;任何视觉改造不得破坏刷新、搜索跳转、恢复或删除语义。- 术语统一:用户可见文案一律说 **Refresh** 与 **Session**,不出现 scan / rescan / rebuild / index(这些只保留在数据层内部命名中)。diff --git a/PRODUCT.md b/PRODUCT.mdindex 965f461..282f45f 100644--- a/PRODUCT.md+++ b/PRODUCT.md@@ -34,7 +34,7 @@ Corey 本人(独立开发者,主力工具 Claude Code 与 Codex,中文为主)。## Brand Commitments-名称 Wake(2026-08-14 由 Vibex 更名;取「船迹」——agent 驶过的痕迹,兼「唤醒」恢复会话之意)。界面语言以英文为源(2026-08-14 由中文切换,用户反馈中文 UI 词汇观感生硬),0.5.2 起经 i18n 层出译文、内置简体中文、首次启动跟随系统语言,Settings → General 可固定某一种。视觉基准(用户 2026-08-14 确认):现代 macOS 原生规范,工艺对标 Things / Bear(优雅轻盈的原生感);支持跟随系统或固定浅/深外观。agent 品牌色作为功能性识别色保留(Claude 橙 #D97757、Codex 绿 #12A06B 等,见 models.rs)。Session locations 自 0.2.9 起归入独立 Settings 窗口,主界面只保留齿轮入口;Settings 固定为 General / Locations / Remote hosts / Connect / Data / Updates / About(Remote hosts 为 0.4.0 新增,Connect 为 0.5.0 新增),不提供默认 “Open In” 终端选择。+名称 Wake(2026-08-14 由 Vibex 更名;取「船迹」——agent 驶过的痕迹,兼「唤醒」恢复会话之意)。界面语言以英文为源(2026-08-14 由中文切换,用户反馈中文 UI 词汇观感生硬),0.5.2 起经 i18n 层出译文、内置简体中文、首次启动跟随系统语言,Settings → General 可固定某一种。视觉基准(用户 2026-08-14 确认):现代 macOS 原生规范,工艺对标 Things / Bear(优雅轻盈的原生感);支持跟随系统或固定浅/深外观;界面整体可放大到 110% / 125% / 150%(2026-10-08,issue #51:⌘+ / ⌘− / ⌘0、显示菜单、Settings → Appearance,文字、控件、侧栏与对话一起放大)。agent 品牌色作为功能性识别色保留(Claude 橙 #D97757、Codex 绿 #12A06B 等,见 models.rs)。Session locations 自 0.2.9 起归入独立 Settings 窗口,主界面只保留齿轮入口;Settings 固定为 General / Appearance / Locations / Remote hosts / Connect / Data / Updates / About(Appearance 为 2026-10-08 新增:外观与界面缩放,General 只剩语言)(Remote hosts 为 0.4.0 新增,Connect 为 0.5.0 新增),不提供默认 “Open In” 终端选择。## Evidence on Handdiff --git a/README.md b/README.mdindex 6d79256..7eccaa5 100644--- a/README.md+++ b/README.md@@ -136,6 +136,12 @@ It prints what the MCP tools return, asserted byte for byte in the test suite apTo make an agent reach for it without being told, install the bundled skill with `npx skills add iAmCorey/Wake` (or copy `skills/wake/` into `~/.claude/skills/wake/`). Claude Code can go one step further and receive the project's recent sessions the moment a session starts, through a `SessionStart` hook that runs `wake-cli` — the recipe is in [docs/cli.md](docs/cli.md#teaching-an-agent-to-use-it).+## Zoom++Everything in Wake — text, controls, the sidebar and the transcript — can be+enlarged to 110%, 125% or 150% with ⌘+ / ⌘− / ⌘0 (Ctrl on Linux and Windows),+the **View** menu on macOS, or **Settings → Appearance**. The level is remembered.+## LanguageWake's interface follows your system language on first launch and falls back to@@ -153,7 +159,7 @@ welcome. See [crates/wake/locales/README.md](crates/wake/locales/README.md).- Credential files (`auth.json` and friends) are never read- Remote hosts are mirrored read-only with `rsync` over your existing SSH setup: only session data and its sidecar files come across (never credentials), nothing on the remote machine is ever written, and the mirror lives inside Wake's own data directory (`remotes/<host>/`), so removing the host removes it- No background network requests — the only network actions are a user-initiated update check against Wake's public GitHub Release metadata and, if you configure remote hosts, SSH/rsync to those hosts on launch, refresh, and Sync now; session data is never sent anywhere else-- Wake's own index lives at `~/Library/Application Support/wake/wake.db` (Linux: `~/.local/share/wake`, Windows: `%LOCALAPPDATA%\wake`) and can be rebuilt from scratch at any time (stars/pins live in a separate table and survive rebuilds). Three small preference files (`appearance`, `language`, `window.json`) sit beside it on macOS, under `~/.config/wake` on Linux and `%APPDATA%\wake` on Windows; Open In and export-folder choices live in the index database's `prefs` table+- Wake's own index lives at `~/Library/Application Support/wake/wake.db` (Linux: `~/.local/share/wake`, Windows: `%LOCALAPPDATA%\wake`) and can be rebuilt from scratch at any time (stars/pins live in a separate table and survive rebuilds). Four small preference files (`appearance`, `language`, `zoom`, `window.json`) sit beside it on macOS, under `~/.config/wake` on Linux and `%APPDATA%\wake` on Windows; Open In and export-folder choices live in the index database's `prefs` table## Performancediff --git a/crates/wake/assets/icons/palette.svg b/crates/wake/assets/icons/palette.svgnew file mode 100644index 0000000..085cac5--- /dev/null+++ b/crates/wake/assets/icons/palette.svg@@ -0,0 +1,18 @@+<!-- @license lucide - ISC -->+<svg+ xmlns="http://www.w3.org/2000/svg"+ width="24"+ height="24"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ stroke-linecap="round"+ stroke-linejoin="round"+>+ <circle cx="13.5" cy="6.5" r=".5" fill="currentColor" />+ <circle cx="17.5" cy="10.5" r=".5" fill="currentColor" />+ <circle cx="8.5" cy="7.5" r=".5" fill="currentColor" />+ <circle cx="6.5" cy="12.5" r=".5" fill="currentColor" />+ <path d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z" />+</svg>diff --git a/crates/wake/locales/zh-Hans.json b/crates/wake/locales/zh-Hans.jsonindex e53a682..216464a 100644--- a/crates/wake/locales/zh-Hans.json+++ b/crates/wake/locales/zh-Hans.json@@ -297,7 +297,6 @@"Thu": "周四","Thursdays": "周四","Today": "今天",- "Toggle Full Screen": "切换全屏","Tokens": "Token","Transcript limit reached": "已达转录上限","Trash": "废纸篓",@@ -472,5 +471,13 @@"Check": "检查","To restore, choose Put Back in Trash, then click Check.": "要恢复文件,请在废纸篓中选择“放回原处”,然后点击检查。","Restore the files in your system trash, then click Check.": "在系统回收站中还原文件,然后点击检查。",- "No restored sessions found. Check the file locations below.": "未找到已还原的会话,请检查下方文件位置。"+ "No restored sessions found. Check the file locations below.": "未找到已还原的会话,请检查下方文件位置。",+ "View": "显示",+ "Zoom In": "放大",+ "Zoom Out": "缩小",+ "Actual Size": "实际大小",+ "Make text and controls larger or smaller.": "放大或缩小文字与控件。",+ "Couldn't save zoom: {}": "无法保存缩放设置:{}",+ "Choose the language Wake uses.": "选择 Wake 的界面语言。",+ "Theme": "主题"}diff --git a/crates/wake/src/assets.rs b/crates/wake/src/assets.rsindex a85eb02..7e87f0e 100644--- a/crates/wake/src/assets.rs+++ b/crates/wake/src/assets.rs@@ -97,6 +97,7 @@ icons!("arrow-up-down","brush-cleaning","sliders-horizontal",+ "palette","check","copy","pin-filled",diff --git a/crates/wake/src/i18n.rs b/crates/wake/src/i18n.rsindex d140685..6e2ba0a 100644--- a/crates/wake/src/i18n.rs+++ b/crates/wake/src/i18n.rs@@ -624,6 +624,7 @@ mod tests {include_str!("workbench/memory.rs"),include_str!("settings.rs"),include_str!("main.rs"),+ include_str!("ui_zoom.rs"),include_str!("index_lock.rs"),include_str!("markdown_links.rs"),include_str!("format.rs"),diff --git a/crates/wake/src/main.rs b/crates/wake/src/main.rsindex c0b9f09..e91f87a 100644--- a/crates/wake/src/main.rs+++ b/crates/wake/src/main.rs@@ -16,6 +16,7 @@ mod prefs;mod settings;mod theme;mod ui;+mod ui_zoom;mod update;mod workbench;@@ -59,8 +60,8 @@ fn open_main_window(cx: &mut App) -> anyhow::Result<WindowHandle<Root>> {TitlebarOptions {title: None,appears_transparent: true,- // 44px Wake 顶部净空中垂直居中 13.5px traffic lights。- traffic_light_position: Some(point(px(20.), px(15.))),+ // 44px Wake 顶部净空中垂直居中 13.5px traffic lights;界面缩放时随之挪位+ traffic_light_position: Some(ui_zoom::traffic_lights(ui_zoom::MAIN_LIGHTS_TOP)),}} else {TitlebarOptions {@@ -74,7 +75,7 @@ fn open_main_window(cx: &mut App) -> anyhow::Result<WindowHandle<Root>> {titlebar: Some(titlebar),window_bounds: Some(window_bounds),display_id,- window_min_size: Some(size(px(940.), px(620.))),+ window_min_size: Some(main_window::MAIN_MIN_SIZE),// Linux 桌面按它归组窗口、匹配 .desktop(StartupWMClass=wake)app_id: Some("wake".into()),// Wayland 显式请求 CSD(2026-08-24 Codex review):默认的 Server@@ -214,6 +215,8 @@ fn key_bindings() -> Vec<KeyBinding> {KeyBinding::new("up", PaletteUp, Some(PALETTE_CONTEXT)),KeyBinding::new("down", PaletteDown, Some(PALETTE_CONTEXT)),];+ // 界面缩放(全局,键位表在 ui_zoom,与设置页的提示同源)+ keys.extend(ui_zoom::key_bindings());if cfg!(target_os = "macos") {keys.extend([KeyBinding::new("secondary-h", Hide, None),@@ -269,6 +272,19 @@ pub(crate) fn app_menus() -> Vec<Menu> {],disabled: false,});+ // 界面缩放三项(全局监听器,见 ui_zoom::register)。+ // 有了名为 View 的菜单,AppKit 会在它末尾自动补系统的 "Enter Full Screen"(macOS+ // 惯例全屏就住在这里),所以 Window 菜单不再放 Wake 自己的全屏项,免得两项重复;+ // ⌃⌘F 的 ToggleFullScreen 绑定照留+ let view = Menu {+ name: t("View").into(),+ items: vec![+ MenuItem::action(t("Zoom In"), ui_zoom::ZoomIn),+ MenuItem::action(t("Zoom Out"), ui_zoom::ZoomOut),+ MenuItem::action(t("Actual Size"), ui_zoom::ActualSize),+ ],+ disabled: false,+ };// 名字必须**逐字**是 "Window",不能翻译:gpui_macos 的 create_menu_bar// 里是 `if menu_config.name == "Window"` 才调 `setWindowsMenu_`,译成// 「窗口」后 AppKit 就不再把它当系统窗口菜单,自动维护的已打开窗口列表@@ -281,7 +297,6 @@ pub(crate) fn app_menus() -> Vec<Menu> {items: vec![MenuItem::action(t("Minimize"), Minimize),MenuItem::action(t("Zoom"), Zoom),- MenuItem::action(t("Toggle Full Screen"), ToggleFullScreen),MenuItem::separator(),MenuItem::action(t("Main Window"), ShowMainWindow),],@@ -299,6 +314,7 @@ pub(crate) fn app_menus() -> Vec<Menu> {disabled: false,}),edit,+ Some(view),window,].into_iter()@@ -316,6 +332,8 @@ fn main() {gpui_component::init(cx);// 必须在 set_menus 与开任何窗之前:两者的文案都在构造那一刻求值i18n::init();+ // 缩放档位要赶在套主题(rem 跟着它)与开窗(traffic light 位置)之前+ ui_zoom::init();theme::sync_appearance(None, cx);cx.on_action(|_: &Quit, cx| main_window::quit(cx));@@ -336,6 +354,7 @@ fn main() {cx.on_action(|_: &HideOthers, cx| cx.hide_other_apps());cx.on_action(|_: &ShowAll, cx| cx.unhide_other_apps());cx.on_action(|_: &ShowMainWindow, cx| show_main_window(cx, |_, _| {}));+ ui_zoom::register(cx);// 无窗时的菜单兜底:有窗时这些 action 由 Workbench/Settings 的视图// 消费(元素级监听器默认截断传播,不会走到这);全部窗口关掉后菜单项// 只认全局监听器,没有就置灰——先把主窗拉回来再转发diff --git a/crates/wake/src/main_window.rs b/crates/wake/src/main_window.rsindex cdfbb5e..24a4394 100644--- a/crates/wake/src/main_window.rs+++ b/crates/wake/src/main_window.rs@@ -24,6 +24,10 @@ use std::time::Duration;/// 首次启动的主窗尺寸const MAIN_SIZE: Size<Pixels> = size(px(1180.), px(760.));+/// 两扇窗的最小尺寸。gpui 只在开窗那一刻设它(macOS `setContentMinSize_`),运行时改不了,+/// 所以界面放大后定宽栏要给其余部分让位(`ui::rails_factor`),让位的量从这里推出+pub const MAIN_MIN_SIZE: Size<Pixels> = size(px(940.), px(620.));+pub const SETTINGS_MIN_SIZE: Size<Pixels> = size(px(720.), px(520.));/// 主窗句柄。无窗时的菜单兜底与 Window → Main Window 据此找主窗,从属窗口/// 据此取主窗几何diff --git a/crates/wake/src/settings.rs b/crates/wake/src/settings.rsindex 0f50f68..a442f37 100644--- a/crates/wake/src/settings.rs+++ b/crates/wake/src/settings.rs@@ -2,7 +2,7 @@ use crate::i18n::t;use gpui::prelude::FluentBuilder as _;use gpui::*;use gpui_component::button::{Button, ButtonCustomVariant, ButtonVariants as _};-use gpui_component::menu::{DropdownMenu as _, PopupMenuItem};+use gpui_component::menu::{DropdownMenu as _, PopupMenu, PopupMenuItem};use gpui_component::switch::Switch;use gpui_component::{h_flex, v_flex, ActiveTheme as _, Disableable as _, Icon, Selectable as _, Sizable as _,@@ -13,9 +13,9 @@ use wake_core::models::AgentId;use crate::format::tilde_path;use crate::ui::{- action_button, overlay_layers, show_in_fm, BUTTON_SM_H, FONT_BODY, FONT_CAPTION, FONT_DISPLAY,- FONT_HEADING, FONT_LABEL, FONT_TITLE, ICON_TEXT_GAP, RADIUS_BUTTON, SPACE_LG, SPACE_MD,- SPACE_SM, SPACE_XL, SPACE_XS, SPACE_XXL,+ action_button, overlay_layers, rails_factor, show_in_fm, zpx, Zpx, BUTTON_SM_H, FONT_BODY,+ FONT_CAPTION, FONT_DISPLAY, FONT_HEADING, FONT_LABEL, FONT_TITLE, ICON_TEXT_GAP, RADIUS_BUTTON,+ SPACE_LG, SPACE_MD, SPACE_SM, SPACE_XL, SPACE_XS, SPACE_XXL,};use crate::update::{self, UpdateStatus};use crate::workbench::{@@ -25,8 +25,11 @@ use crate::workbench::{use crate::{theme, theme::AppearancePreference};use std::rc::Rc;-const SETTINGS_SIDEBAR_W: Pixels = px(180.);-const SETTINGS_PAGE_TOP: Pixels = px(38.);+const SETTINGS_SIDEBAR_W: Zpx = Zpx(180.);+/// 侧栏顶上的标题栏条(gpui-component TitleBar 默认的 34px)。显式给成随缩放的同值:+/// traffic light 随缩放挪位,这条不跟着变高的话灯就落到它的下沿上+const SETTINGS_TITLEBAR_H: Zpx = Zpx(34.);+const SETTINGS_PAGE_TOP: Zpx = Zpx(38.);/// Connect 页两条 Setup guide 的去处:MCP 面与命令行面各自的完整文档const CONNECT_GUIDE_URL: &str = "https://github.com/iAmCorey/Wake/blob/main/docs/mcp.md";const CONNECT_CLI_GUIDE_URL: &str = "https://github.com/iAmCorey/Wake/blob/main/docs/cli.md";@@ -54,6 +57,7 @@ fn format_storage_size(bytes: u64) -> String {#[derive(Clone, Copy, PartialEq, Eq)]pub(crate) enum SettingsPage {General,+ Appearance,Locations,MemoryLocations,Remotes,@@ -110,7 +114,7 @@ fn settings_page_header(title: &'static str, subtitle: &'static str, cx: &App) -.px(SPACE_XXL).pt(SETTINGS_PAGE_TOP).pb(SPACE_XL)- .gap(px(5.))+ .gap(zpx(5.)).child(div().text_size(FONT_TITLE)@@ -126,10 +130,28 @@ fn settings_page_header(title: &'static str, subtitle: &'static str, cx: &App) -)}-/// "一张卡一行"的信息卡(Data 的 Storage、Connect 的 MCP server 共用):popover-/// 底圆角卡,84px 行,主信息 FONT_BODY,副行由调用方给(caption 级),右侧一个操作+/// 设置行右侧的下拉(语言、缩放):描边小按钮 + 当前值 + chevron,菜单项由调用方填+fn select_control(+ id: &'static str,+ label: impl Into<SharedString>,+ menu_min_w: Zpx,+ items: impl Fn(PopupMenu) -> PopupMenu + 'static,+) -> AnyElement {+ Button::new(id)+ .outline()+ .small()+ .rounded(RADIUS_BUTTON)+ .label(label)+ .icon(icon("icons/chevron-down.svg").with_size(zpx(14.)))+ .dropdown_menu(move |menu, _, _| items(menu.min_w(menu_min_w)))+ .into_any_element()+}++/// "一张卡一行"的信息卡(Data、Connect、Updates 的卡与 General / Appearance 的设置行+/// 共用):popover 底圆角卡,行高由调用方给(设置行 72、其余 84),主信息 FONT_BODY,+/// 副行由调用方给(caption 级),右侧一个操作fn settings_info_card(- primary: &'static str,+ primary: impl Into<SharedString>,details: Vec<AnyElement>,trailing: AnyElement,min_h: Pixels,@@ -150,18 +172,23 @@ fn settings_info_card(h_flex().min_h(min_h).px(SPACE_LG)+ .py(SPACE_MD).gap(SPACE_LG).items_center()+ // 放不下时右侧控件换到下一行,而不是把标题挤成一字一行(界面放大后+ // 设置窗常常比内容窄:窗口大小不随档位变)。100% 档宽度够,不换行,+ // py 也小于 min_h 留的余量,版式不变+ .flex_wrap().child(v_flex().flex_1()- .min_w_0()- .gap(px(3.))+ .min_w(zpx(180.))+ .gap(zpx(3.)).child(div().text_size(FONT_BODY).text_color(theme.foreground)- .child(primary),+ .child(primary.into()),).children(details),)@@ -238,6 +265,8 @@ pub(crate) struct SettingsView {/// notify),不在 render 里每帧算——原先 hover 一下就重查一遍库(2026-09-22 /simplify)locations: LocationSettingsSnapshot,memory_locations: MemoryLocationSettingsSnapshot,+ /// 上次挪 traffic light 时的缩放档位(`ui_zoom::changed`)+ zoom: u16,_workbench_observer: Option<Subscription>,}@@ -256,9 +285,9 @@ fn row_menu(.ghost().small().rounded(RADIUS_BUTTON)- .icon(icon("icons/more-horizontal.svg").with_size(px(14.)))+ .icon(icon("icons/more-horizontal.svg").with_size(zpx(14.))).dropdown_menu(move |menu, _, _| {- let mut menu = menu.min_w(px(180.));+ let mut menu = menu.min_w(zpx(180.));if let Some(edit) = edit.clone() {menu = menu.item(PopupMenuItem::new(t("Edit…")).on_click(move |_, window, cx| edit(window, cx)),@@ -318,6 +347,7 @@ impl SettingsView {connect_shown: Default::default(),copied: None,copied_generation: 0,+ zoom: crate::ui_zoom::percent(),locations: LocationSettingsSnapshot {rows: Vec::new(),diverged: false,@@ -343,7 +373,7 @@ impl SettingsView {let workbench = self.workbench.clone();h_flex().id(id)- .h(px(34.))+ .h(zpx(34.)).w_full().px(SPACE_MD).gap(SPACE_SM)@@ -361,8 +391,16 @@ impl SettingsView {.on_click(move |_, _, cx| {workbench.update(cx, |this, cx| this.select_settings_page(page, cx));})- .child(icon(icon_path).with_size(px(15.)).flex_shrink_0())- .child(div().text_size(FONT_BODY).font_medium().child(label))+ .child(icon(icon_path).with_size(zpx(15.)).flex_shrink_0())+ // 放大档位下侧栏可能比标签窄:单行截断,行高是定的,换成两行会压到下一项+ .child(+ div()+ .min_w_0()+ .truncate()+ .text_size(FONT_BODY)+ .font_medium()+ .child(label),+ ).into_any_element()}@@ -371,14 +409,22 @@ impl SettingsView {let show_titlebar = cfg!(target_os = "macos")|| matches!(window.window_decorations(), Decorations::Client { .. });+ // 侧栏随界面缩放放大,窗口不够宽时给内容区让位(与主窗的两条栏同一条规则)+ let scale = rails_factor(+ SETTINGS_SIDEBAR_W.0,+ window.viewport_size().width,+ crate::main_window::SETTINGS_MIN_SIZE.width,+ );v_flex()- .w(SETTINGS_SIDEBAR_W)+ .w(px(SETTINGS_SIDEBAR_W.0 * scale)).h_full().flex_shrink_0().bg(theme.sidebar).border_r_1().border_color(theme.sidebar_border)- .when(show_titlebar, |this| this.child(TitleBar::new()))+ .when(show_titlebar, |this| {+ this.child(TitleBar::new().h(SETTINGS_TITLEBAR_H))+ }).child(div().px(SPACE_LG)@@ -389,82 +435,98 @@ impl SettingsView {.text_color(theme.sidebar_foreground).child(t("Settings")),)+ // 放大档位下两组导航可能比窗口高:包进滚动容器。上面那组 flex_1 把下面那组+ // 顶到底;放不下时它不会被压到内容以下,于是溢出、可滚.child(v_flex()+ .id("settings-nav-scroll").flex_1()- .px(SPACE_SM)- .gap(px(2.))- .child(self.render_nav_item(- "settings-general-nav",- t("General"),- "icons/settings.svg",- SettingsPage::General,- cx,- ))- .child(self.render_nav_item(- "settings-locations-nav",- t("Session locations"),- "icons/hard-drive.svg",- SettingsPage::Locations,- cx,- ))- .child(self.render_nav_item(- "settings-memory-locations-nav",- t("Memory locations"),- "icons/brain.svg",- SettingsPage::MemoryLocations,- cx,- ))- .child(self.render_nav_item(- "settings-remotes-nav",- t("Remote hosts"),- "icons/server.svg",- SettingsPage::Remotes,- cx,- ))- .child(self.render_nav_item(- "settings-connect-nav",- t("Connect"),- "icons/plug.svg",- SettingsPage::Connect,- cx,- ))- .child(self.render_nav_item(- "settings-data-nav",- t("Data"),- "icons/database.svg",- SettingsPage::Data,- cx,- )),- )- .child(- v_flex()- .px(SPACE_SM)- .pb(SPACE_SM)- .gap(px(2.))- .child(self.render_nav_item(- "settings-updates-nav",- t("Updates"),- "icons/download.svg",- SettingsPage::Updates,- cx,- ))- .child(self.render_nav_item(- "settings-about-nav",- t("About"),- "icons/info.svg",- SettingsPage::About,- cx,- )),+ .min_h_0()+ .overflow_y_scroll()+ .child(+ v_flex()+ .flex_1()+ .px(SPACE_SM)+ .gap(zpx(2.))+ .child(self.render_nav_item(+ "settings-general-nav",+ t("General"),+ "icons/settings.svg",+ SettingsPage::General,+ cx,+ ))+ .child(self.render_nav_item(+ "settings-appearance-nav",+ t("Appearance"),+ "icons/palette.svg",+ SettingsPage::Appearance,+ cx,+ ))+ .child(self.render_nav_item(+ "settings-locations-nav",+ t("Session locations"),+ "icons/hard-drive.svg",+ SettingsPage::Locations,+ cx,+ ))+ .child(self.render_nav_item(+ "settings-memory-locations-nav",+ t("Memory locations"),+ "icons/brain.svg",+ SettingsPage::MemoryLocations,+ cx,+ ))+ .child(self.render_nav_item(+ "settings-remotes-nav",+ t("Remote hosts"),+ "icons/server.svg",+ SettingsPage::Remotes,+ cx,+ ))+ .child(self.render_nav_item(+ "settings-connect-nav",+ t("Connect"),+ "icons/plug.svg",+ SettingsPage::Connect,+ cx,+ ))+ .child(self.render_nav_item(+ "settings-data-nav",+ t("Data"),+ "icons/database.svg",+ SettingsPage::Data,+ cx,+ )),+ )+ .child(+ v_flex()+ .px(SPACE_SM)+ .pb(SPACE_SM)+ .gap(zpx(2.))+ .child(self.render_nav_item(+ "settings-updates-nav",+ t("Updates"),+ "icons/download.svg",+ SettingsPage::Updates,+ cx,+ ))+ .child(self.render_nav_item(+ "settings-about-nav",+ t("About"),+ "icons/info.svg",+ SettingsPage::About,+ cx,+ )),+ ),).into_any_element()}- /// General 页的设置行:与 Data/Connect 的信息卡同一张卡,只是矮一档- /// (72 是 Appearance 行的用户定稿值),副行是 caption 级说明+ /// General / Appearance 页的设置行:与 Data / Connect / Updates 同一张信息卡,只是矮+ /// 一档(72 是 Theme 行的用户定稿值),副行是 caption 级说明fn setting_row(title: &'static str,- subtitle: &'static str,+ subtitle: impl IntoElement,control: impl IntoElement,cx: &Context<Self>,) -> AnyElement {@@ -477,56 +539,69 @@ impl SettingsView {title,vec![caption],control.into_any_element(),- px(72.),+ zpx(72.),cx,).into_any_element()}/// 语言选择:System + English + 装好的语言包。选项数量随语言包增减,- /// 所以是下拉而不是 Appearance 那样的分段控件+ /// 所以是下拉而不是 Theme 那样的分段控件fn language_control(&self) -> AnyElement {// 直接读全局:镜像成字段就要在每个切换点写回,而 `apply_language`// 改的是全局(appearance 那个字段正是这么漂的)let current = crate::i18n::preference().map(|locale| locale.tag);- Button::new("settings-language")- .outline()- .small()- .rounded(RADIUS_BUTTON)- .label(current.map_or(t("System"), |tag| {+ let label = current.map_or(t("System"), |tag| {+ crate::i18n::available()+ .iter()+ .find(|locale| locale.tag == tag)+ .map_or(t("System"), |locale| locale.name)+ });+ select_control("settings-language", label, Zpx(160.), move |mut menu| {+ // 选项只在菜单打开时才需要,`available()` 又是 'static 切片+ // ——留在闭包里就不必每帧建一个 Vec 再 clone 一份进来+ let options = std::iter::once((None, t("System"))).chain(crate::i18n::available().iter()- .find(|locale| locale.tag == tag)- .map_or(t("System"), |locale| locale.name)- }))- .icon(icon("icons/chevron-down.svg").with_size(px(14.)))- .dropdown_menu(move |mut menu, _, _| {- // 选项只在菜单打开时才需要,`available()` 又是 'static 切片- // ——留在闭包里就不必每帧建一个 Vec 再 clone 一份进来- menu = menu.min_w(px(160.));- let options = std::iter::once((None, t("System"))).chain(- crate::i18n::available()- .iter()- .map(|locale| (Some(locale.tag), locale.name)),- );- for (tag, name) in options {- menu = menu.item(PopupMenuItem::new(name).checked(tag == current).on_click(- move |_, window, cx| {- if let Err(error) = crate::i18n::set_language(tag, cx) {- window.push_notification(- gpui_component::notification::Notification::error(crate::tf!(- "Couldn't save language: {}",- error- )),- cx,- );- }- },- ));+ .map(|locale| (Some(locale.tag), locale.name)),+ );+ for (tag, name) in options {+ menu = menu.item(PopupMenuItem::new(name).checked(tag == current).on_click(+ move |_, window, cx| {+ if let Err(error) = crate::i18n::set_language(tag, cx) {+ window.push_notification(+ gpui_component::notification::Notification::error(crate::tf!(+ "Couldn't save language: {}",+ error+ )),+ cx,+ );+ }+ },+ ));+ }+ menu+ })+ }++ /// 界面缩放档位:与 ⌘+ / ⌘− / ⌘0、显示菜单是同一个设置。档位多,与语言一样用下拉+ fn zoom_control(&self) -> AnyElement {+ let current = crate::ui_zoom::percent();+ select_control(+ "settings-zoom",+ crate::ui_zoom::label(current),+ Zpx(120.),+ move |mut menu| {+ for level in crate::ui_zoom::LEVELS {+ menu = menu.item(+ PopupMenuItem::new(crate::ui_zoom::label(level))+ .checked(level == current)+ .on_click(move |_, _, cx| crate::ui_zoom::change(level, cx)),+ );}menu- })- .into_any_element()+ },+ )}fn appearance_button(@@ -551,7 +626,7 @@ impl SettingsView {.active(theme.popover),).small()- .w(px(64.))+ .w(zpx(64.)).rounded(RADIUS_BUTTON).label(label).selected(selected)@@ -573,78 +648,108 @@ impl SettingsView {}))}- fn render_general(&mut self, cx: &mut Context<Self>) -> AnyElement {- let theme = cx.theme();+ /// 设置各页(Session / Memory locations 与 Remote hosts 之外)的骨架:页头 + 可滚动的+ /// 内容列(界面放大后卡片会换行变高,一屏放不下)+ fn rows_page(+ id: &'static str,+ title: &'static str,+ subtitle: &'static str,+ gap: Zpx,+ rows: impl IntoIterator<Item = AnyElement>,+ cx: &App,+ ) -> AnyElement {v_flex().flex_1().min_w_0().h_full()- .bg(theme.background)- .child(- v_flex()- .flex_shrink_0()- .px(SPACE_XXL)- .pt(SETTINGS_PAGE_TOP)- .pb(SPACE_XL)- .gap(px(5.))- .child(- div()- .text_size(FONT_TITLE)- .font_semibold()- .text_color(theme.foreground)- .child(t("General")),- )- .child(- div()- .text_size(FONT_CAPTION)- .text_color(theme.muted_foreground)- .child(t("Customize how Wake looks and reads.")),- ),- )+ .bg(cx.theme().background)+ .child(settings_page_header(title, subtitle, cx)).child(v_flex()+ .id(id)+ .flex_1()+ .min_h_0()+ .overflow_y_scroll().px(SPACE_XXL)- .gap(SPACE_MD)- .child(Self::setting_row(- t("Appearance"),- t("Follow the system or keep Wake light or dark."),- h_flex()- .h(BUTTON_SM_H + px(4.))- .p(px(2.))- .rounded(theme.radius)- .border_1()- .border_color(theme.border)- .bg(theme.secondary)- .child(self.appearance_button(- "appearance-system",- t("System"),- AppearancePreference::System,- cx,- ))- .child(self.appearance_button(- "appearance-light",- t("Light"),- AppearancePreference::Light,- cx,- ))- .child(self.appearance_button(- "appearance-dark",- t("Dark"),- AppearancePreference::Dark,- cx,- )),- cx,- ))- .child(Self::setting_row(- t("Language"),- t("Follow the system language, or pick one."),- self.language_control(),- cx,- )),+ .pb(SPACE_XXL)+ .gap(gap)+ .children(rows),).into_any_element()}+ fn render_general(&mut self, cx: &mut Context<Self>) -> AnyElement {+ let rows = [Self::setting_row(+ t("Language"),+ t("Follow the system language, or pick one."),+ self.language_control(),+ cx,+ )];+ Self::rows_page(+ "settings-general-scroll",+ t("General"),+ t("Choose the language Wake uses."),+ SPACE_MD,+ rows,+ cx,+ )+ }++ /// 外观与界面缩放(2026-10-08 用户定:自成一页,不放 General)+ fn render_appearance(&mut self, cx: &mut Context<Self>) -> AnyElement {+ let theme = cx.theme();+ let modes = h_flex()+ .h(BUTTON_SM_H + zpx(4.))+ .p(zpx(2.))+ .rounded(theme.radius)+ .border_1()+ .border_color(theme.border)+ .bg(theme.secondary)+ .child(self.appearance_button(+ "appearance-system",+ t("System"),+ AppearancePreference::System,+ cx,+ ))+ .child(self.appearance_button(+ "appearance-light",+ t("Light"),+ AppearancePreference::Light,+ cx,+ ))+ .child(self.appearance_button(+ "appearance-dark",+ t("Dark"),+ AppearancePreference::Dark,+ cx,+ ));+ // 快捷键自成一段、不在中间断行:gpui 在每个符号前都允许折行,窄的时候会把+ // "⌘" 和 "+" 拆到两行。放不下就整段换到下一行+ let zoom_caption = h_flex()+ .w_full()+ .flex_wrap()+ .gap_x(zpx(4.))+ .child(t("Make text and controls larger or smaller."))+ .child(div().whitespace_nowrap().child(crate::ui_zoom::key_hints()));+ let rows = [+ Self::setting_row(+ t("Theme"),+ t("Follow the system or keep Wake light or dark."),+ modes,+ cx,+ ),+ Self::setting_row(t("Zoom"), zoom_caption, self.zoom_control(), cx),+ ];+ Self::rows_page(+ "settings-appearance-scroll",+ t("Appearance"),+ t("Customize how Wake looks and reads."),+ SPACE_MD,+ rows,+ cx,+ )+ }+fn render_data(&mut self, cx: &mut Context<Self>) -> AnyElement {let theme = cx.theme();let snapshot = self.workbench.read(cx).data_settings_snapshot();@@ -667,7 +772,7 @@ impl SettingsView {let reveal_path = snapshot.raw_path.clone();let show_in_finder = settings_button(Button::new("settings-show-data")- .icon(icon("icons/folder.svg").with_size(px(13.)))+ .icon(icon("icons/folder.svg").with_size(zpx(13.))).label(show_in_fm()),cx,)@@ -689,36 +794,30 @@ impl SettingsView {.into_any_element(),];- v_flex()- .flex_1()- .min_w_0()- .h_full()- .bg(theme.background)- .child(settings_page_header(- t("Data"),- t("See where Wake stores local data. Sessions refresh automatically."),+ let rows = [+ div()+ .text_size(FONT_CAPTION)+ .font_semibold()+ .text_color(theme.foreground)+ .child(t("Storage"))+ .into_any_element(),+ settings_info_card(+ t("Wake data"),+ details,+ show_in_finder.into_any_element(),+ zpx(84.),cx,- ))- .child(- v_flex()- .px(SPACE_XXL)- .gap(SPACE_SM)- .child(- div()- .text_size(FONT_CAPTION)- .font_semibold()- .text_color(theme.foreground)- .child(t("Storage")),- )- .child(settings_info_card(- t("Wake data"),- details,- show_in_finder.into_any_element(),- px(84.),- cx,- )),)- .into_any_element()+ .into_any_element(),+ ];+ Self::rows_page(+ "settings-data-scroll",+ t("Data"),+ t("See where Wake stores local data. Sessions refresh automatically."),+ SPACE_SM,+ rows,+ cx,+ )}/// Settings → Connect 的复制按钮:写剪贴板,按钮原地变 "Copied" 片刻后复原@@ -739,7 +838,7 @@ impl SettingsView {} else {"icons/copy.svg"})- .with_size(px(13.)),+ .with_size(zpx(13.)),).label(if copied { t("Copied") } else { label }),cx,@@ -811,7 +910,7 @@ impl SettingsView {} else {"icons/chevron-right.svg"})- .with_size(px(13.)),+ .with_size(zpx(13.)),).label(if shown { t("Hide") } else { t("Show") }).on_click(cx.listener(move |this, _, _, cx| {@@ -828,17 +927,17 @@ impl SettingsView {.child(h_flex().w_full()- .min_h(px(52.))+ .min_h(zpx(52.)).px(SPACE_LG).py(SPACE_SM).gap(ICON_TEXT_GAP).items_center()- .child(img(s.agent.brand_icon(dark)).size(px(17.)).flex_shrink_0())+ .child(img(s.agent.brand_icon(dark)).size(zpx(17.)).flex_shrink_0()).child(v_flex().flex_1().min_w_0()- .gap(px(2.))+ .gap(zpx(2.)).child(div().text_size(FONT_BODY)@@ -864,7 +963,7 @@ impl SettingsView {this.child(// 左缘对齐到文字轴:行内边距 + 图标 17 + 间距 12v_flex()- .ml(SPACE_LG + px(17.) + SPACE_MD)+ .ml(SPACE_LG + zpx(17.) + SPACE_MD).mr(SPACE_LG).mb(SPACE_MD).px(SPACE_MD)@@ -918,7 +1017,7 @@ impl SettingsView {.children(extra).child(self.copy_button(id.into(), t("Copy path"), f.path.clone(), cx)).into_any_element(),- px(84.),+ zpx(84.),cx,)};@@ -941,7 +1040,7 @@ impl SettingsView {cx,).into_any_element(),- px(84.),+ zpx(84.),cx,);@@ -974,69 +1073,55 @@ impl SettingsView {}))};- v_flex()- .flex_1()- .min_w_0()- .h_full()- .bg(theme.background)- .child(settings_page_header(- t("Connect"),- t("Let your coding agents look up your past sessions from Wake."),- cx,- ))- .child(- v_flex()- .id("settings-connect-scroll")- .flex_1()- .min_h_0()- .overflow_y_scroll()- .px(SPACE_XXL)- .pb(SPACE_XXL)- .gap(SPACE_SM)- // 四个区块同一种写法,有没有文档链接写在参数里,不靠两种拼法- // 区分。规则一句话:**每个面的第一个区块挂自己的文档**——- // MCP 面 = MCP server + MCP clients,命令行面 = Command line- // + Skill,所以链接落在第一、第三块上。第五个区块该不该有- // 链接,照这条判就行,不用再拍脑袋- .child(titled(- t("MCP server"),- Some(("connect-setup-guide", CONNECT_GUIDE_URL)),- ))- .child(binary_card(- "wake-mcp",- "connect-copy-path",- &info.mcp,- None,- ))- .child(titled(t("MCP clients"), None).pt(SPACE_LG))- .child(- v_flex()- .w_full()- .flex_shrink_0()- .overflow_hidden()- .rounded(theme.radius_lg)- .border_1()- .border_color(theme.border)- .bg(theme.popover)- .children(agent_rows),- )- .child(- titled(- t("Command line"),- Some(("connect-cli-setup-guide", CONNECT_CLI_GUIDE_URL)),- )- .pt(SPACE_LG),- )- .child(binary_card(- "wake-cli",- "connect-copy-cli-path",- &info.cli,- copy_cli_command,- ))- .child(titled(t("Skill"), None).pt(SPACE_LG))- .child(skill_card),+ // 四个区块同一种写法,有没有文档链接写在参数里,不靠两种拼法+ // 区分。规则一句话:**每个面的第一个区块挂自己的文档**——+ // MCP 面 = MCP server + MCP clients,命令行面 = Command line+ // + Skill,所以链接落在第一、第三块上。第五个区块该不该有+ // 链接,照这条判就行,不用再拍脑袋+ let rows = [+ titled(+ t("MCP server"),+ Some(("connect-setup-guide", CONNECT_GUIDE_URL)),)- .into_any_element()+ .into_any_element(),+ binary_card("wake-mcp", "connect-copy-path", &info.mcp, None).into_any_element(),+ titled(t("MCP clients"), None)+ .pt(SPACE_LG)+ .into_any_element(),+ v_flex()+ .w_full()+ .flex_shrink_0()+ .overflow_hidden()+ .rounded(theme.radius_lg)+ .border_1()+ .border_color(theme.border)+ .bg(theme.popover)+ .children(agent_rows)+ .into_any_element(),+ titled(+ t("Command line"),+ Some(("connect-cli-setup-guide", CONNECT_CLI_GUIDE_URL)),+ )+ .pt(SPACE_LG)+ .into_any_element(),+ binary_card(+ "wake-cli",+ "connect-copy-cli-path",+ &info.cli,+ copy_cli_command,+ )+ .into_any_element(),+ titled(t("Skill"), None).pt(SPACE_LG).into_any_element(),+ skill_card.into_any_element(),+ ];+ Self::rows_page(+ "settings-connect-scroll",+ t("Connect"),+ t("Let your coding agents look up your past sessions from Wake."),+ SPACE_SM,+ rows,+ cx,+ )}fn about_link(@@ -1074,12 +1159,12 @@ impl SettingsView {.bg(theme.background).child(v_flex()- .w(px(360.))+ .w(zpx(360.)).items_center()- .pt(px(52.))+ .pt(zpx(52.)).child(img("brands/wake.svg")- .size(px(78.))+ .size(zpx(78.)).flex_shrink_0().mb(SPACE_MD),)@@ -1105,13 +1190,13 @@ impl SettingsView {.text_color(theme.muted_foreground).child(t("All your AI agent sessions, in one place.")),)- .child(div().mt(px(14.)).child(self.about_link(+ .child(div().mt(zpx(14.)).child(self.about_link("about-github","GitHub ↗","https://github.com/iAmCorey/Wake",cx,)))- .child(div().w(px(32.)).h(px(1.)).my(SPACE_LG).bg(theme.border))+ .child(div().w(zpx(32.)).h(px(1.)).my(SPACE_LG).bg(theme.border)).child(div().text_size(FONT_LABEL)@@ -1186,70 +1271,29 @@ impl SettingsView {});}- v_flex()- .flex_1()- .min_w_0()- .h_full()- .bg(theme.background)- .child(- v_flex()- .flex_shrink_0()- .px(SPACE_XXL)- .pt(SETTINGS_PAGE_TOP)- .pb(SPACE_XL)- .gap(px(5.))- .child(- div()- .text_size(FONT_TITLE)- .font_semibold()- .text_color(theme.foreground)- .child(t("Updates")),- )- .child(- div()- .text_size(FONT_CAPTION)- .text_color(theme.muted_foreground)- .child(t("Keep Wake up to date.")),- ),- )- .child(- v_flex().px(SPACE_XXL).child(- h_flex()- .min_h(px(84.))- .w_full()- .px(SPACE_LG)- .gap(SPACE_LG)- .items_center()- .rounded(theme.radius_lg)- .border_1()- .border_color(theme.border)- .bg(theme.popover)- .child(- v_flex()- .flex_1()- .min_w_0()- .gap(px(3.))- .child(- div()- .text_size(FONT_BODY)- .text_color(theme.foreground)- .child(format!("Wake {}", env!("CARGO_PKG_VERSION"))),- )- .child(- div()- .text_size(FONT_CAPTION)- .text_color(if matches!(status, UpdateStatus::Failed) {- theme.danger- } else {- theme.muted_foreground- })- .child(status_message),- ),- )- .child(action),- ),- )- .into_any_element()+ let card = settings_info_card(+ concat!("Wake ", env!("CARGO_PKG_VERSION")),+ vec![div()+ .text_size(FONT_CAPTION)+ .text_color(if matches!(status, UpdateStatus::Failed) {+ theme.danger+ } else {+ theme.muted_foreground+ })+ .child(status_message)+ .into_any_element()],+ action.into_any_element(),+ zpx(84.),+ cx,+ );+ Self::rows_page(+ "settings-updates-scroll",+ t("Updates"),+ t("Keep Wake up to date."),+ SPACE_MD,+ [card.into_any_element()],+ cx,+ )}/// 两页 location 面板的快照重读(见字段注释):只刷当前显示的那页——切页走 Workbench@@ -1377,7 +1421,7 @@ impl SettingsView {let theme = cx.theme();h_flex().id(("settings-location-row", ix))- .min_h(px(60.))+ .min_h(zpx(60.)).w_full().px(SPACE_LG).gap(SPACE_MD)@@ -1386,7 +1430,7 @@ impl SettingsView {v_flex().flex_1().min_w_0()- .gap(px(3.))+ .gap(zpx(3.)).child(div().w_full()@@ -1439,10 +1483,10 @@ impl SettingsView {.gap(SPACE_SM).child(h_flex()- .h(px(24.))+ .h(zpx(24.)).gap(ICON_TEXT_GAP).items_center()- .child(img(agent.brand_icon(dark)).size(px(17.)).flex_shrink_0())+ .child(img(agent.brand_icon(dark)).size(zpx(17.)).flex_shrink_0()).child(div().text_size(FONT_CAPTION)@@ -1518,7 +1562,7 @@ impl SettingsView {.child(h_flex().id("settings-unavailable-locations")- .h(px(36.))+ .h(zpx(36.)).w_full().pr(SPACE_SM).gap(SPACE_SM)@@ -1533,7 +1577,7 @@ impl SettingsView {})).child(div()- .w(px(17.))+ .w(zpx(17.)).flex_shrink_0().flex().items_center()@@ -1544,7 +1588,7 @@ impl SettingsView {} else {"icons/chevron-right.svg"})- .with_size(px(13.)),+ .with_size(zpx(13.)),),).child(@@ -1632,7 +1676,7 @@ impl SettingsView {v_flex().flex_1().min_w_0()- .gap(px(5.))+ .gap(zpx(5.)).child(div().text_size(FONT_TITLE)@@ -1650,7 +1694,7 @@ impl SettingsView {.child(settings_button(Button::new("settings-add-location")- .icon(icon("icons/plus.svg").with_size(px(13.)))+ .icon(icon("icons/plus.svg").with_size(zpx(13.))).label(t("Add location")),cx,)@@ -1663,10 +1707,10 @@ impl SettingsView {.ghost().small().rounded(RADIUS_BUTTON)- .icon(icon("icons/more-horizontal.svg").with_size(px(14.)))+ .icon(icon("icons/more-horizontal.svg").with_size(zpx(14.))).dropdown_menu(move |menu, _, _| {let workbench = restore_workbench.clone();- menu.min_w(px(180.)).item(+ menu.min_w(zpx(180.)).item(PopupMenuItem::new(t("Restore defaults")).disabled(!diverged).on_click(move |_, window, cx| {@@ -1685,7 +1729,7 @@ impl SettingsView {.min_h_0().overflow_y_scroll().px(SPACE_XXL)- .pb(px(40.))+ .pb(zpx(40.)).gap(SPACE_XL).children(list),)@@ -1717,13 +1761,13 @@ impl SettingsView {.ghost().small().rounded(RADIUS_BUTTON)- .icon(icon("icons/more-horizontal.svg").with_size(px(14.)))+ .icon(icon("icons/more-horizontal.svg").with_size(zpx(14.))).dropdown_menu(move |menu, _, _| {let sync_workbench = menu_workbench.clone();let sync_name = menu_name.clone();let remove_workbench = menu_workbench.clone();let remove_name = menu_name.clone();- menu.min_w(px(180.))+ menu.min_w(zpx(180.)).item(PopupMenuItem::new(t("Sync now")).disabled(syncing || !enabled)@@ -1750,7 +1794,7 @@ impl SettingsView {.child(h_flex().id(("settings-remote-host-row", ix))- .min_h(px(60.))+ .min_h(zpx(60.)).w_full().px(SPACE_LG).gap(SPACE_MD)@@ -1759,7 +1803,7 @@ impl SettingsView {v_flex().flex_1().min_w_0()- .gap(px(3.))+ .gap(zpx(3.)).child(div().w_full()@@ -1829,7 +1873,7 @@ impl SettingsView {v_flex().flex_1().min_w_0()- .gap(px(5.))+ .gap(zpx(5.)).child(div().text_size(FONT_TITLE)@@ -1851,7 +1895,7 @@ impl SettingsView {this.child(settings_button(Button::new("settings-sync-remotes")- .icon(icon("icons/refresh-cw.svg").with_size(px(13.)))+ .icon(icon("icons/refresh-cw.svg").with_size(zpx(13.))).label(if syncing { t("Syncing…") } else { t("Sync now") }),cx,)@@ -1865,7 +1909,7 @@ impl SettingsView {.child(settings_button(Button::new("settings-add-remote-host")- .icon(icon("icons/plus.svg").with_size(px(13.)))+ .icon(icon("icons/plus.svg").with_size(zpx(13.))).label(t("Add host")),cx,)@@ -1882,7 +1926,7 @@ impl SettingsView {.min_h_0().overflow_y_scroll().px(SPACE_XXL)- .pb(px(40.))+ .pb(zpx(40.)).gap(SPACE_XL).when(has_hosts, |this| {this.child(@@ -1920,12 +1964,16 @@ impl Focusable for SettingsView {impl Render for SettingsView {fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+ if crate::ui_zoom::changed(&mut self.zoom) {+ crate::ui_zoom::move_traffic_lights(crate::ui_zoom::SETTINGS_LIGHTS_TOP, window);+ }let background = cx.theme().background;let foreground = cx.theme().foreground;let sidebar = self.render_sidebar(window, cx);let selected_page = self.workbench.read(cx).settings_page();let content = match selected_page {SettingsPage::General => self.render_general(cx),+ SettingsPage::Appearance => self.render_appearance(cx),SettingsPage::Locations => self.render_locations(cx).into_any_element(),SettingsPage::MemoryLocations => self.render_memory_locations(cx).into_any_element(),SettingsPage::Remotes => self.render_remotes(cx),diff --git a/crates/wake/src/theme.rs b/crates/wake/src/theme.rsindex a6f6e8f..4a02d15 100644--- a/crates/wake/src/theme.rs+++ b/crates/wake/src/theme.rs@@ -263,14 +263,18 @@ pub fn apply_wake_theme(cx: &mut App) {// 系统 UI 字体);写死 `.AppleSystemUIFont` 会让非 mac 平台每个字重都// 走一遍"找不到→回落"的错误路径(2026-08-25 review)theme.font_family = ".SystemUIFont".into();- theme.font_size = gpui::px(14.);- theme.radius = gpui::px(8.);+ // 界面缩放(ui_zoom):gpui-component 的组件按 rem 排版,Root 每帧把 rem 设成+ // font_size;等宽字号(TextView 代码块)与两档圆角是组件直接读的像素值,一并乘上。+ // 13 是 gpui-component 的默认等宽字号,100% 档与缩放落地前相同+ theme.font_size = crate::ui::zpx(14.);+ theme.mono_font_size = crate::ui::zpx(13.);+ theme.radius = crate::ui::zpx(8.);// 聚焦态只把边框染成 ring 色,不画框外的环:gpui-component 的环是元素框外// 2px 的绝对定位子元素,任何裁切祖先(弹窗面板、滚动列表、圆角容器)都会// 切掉一截——Add host / Add location 表单与设置页里实测残缺(2026-09-03// 用户反馈两轮)。上游自己的建议就是版式裁切多的应用关掉它,边框不占空间theme.focus_ring = false;- theme.radius_lg = gpui::px(12.);+ theme.radius_lg = crate::ui::zpx(12.);theme.shadow = true;}diff --git a/crates/wake/src/ui.rs b/crates/wake/src/ui.rsindex 6536b9e..5c880b0 100644--- a/crates/wake/src/ui.rs+++ b/crates/wake/src/ui.rs@@ -2,37 +2,140 @@//! 规则:所有 UI 字号必须引用本模块常量,禁止裸 px 数字与 rem 工具类//! (text_sm 等按 rem=14px 折算会产生 12.25px 这类幽灵值)。//! 颜色只用三级:foreground(主文字)/muted_foreground(辅助)/primary(强调)。+//!+//! 尺寸随界面缩放(`ui_zoom`):常量写成 `Zpx`,表达式里的字面量写 `zpx(…)`。+//! 裸 `px` 只留给不该跟着放大的东西:1px 发丝线、窗口尺寸、测试。use std::collections::HashSet;+use std::ops::{Add, Mul, Neg, Sub};use gpui::{- div, px, AnyElement, App, Div, Global, Hsla, InteractiveElement as _, IntoElement, MouseButton,- Pixels, Styled, Window, WindowId,+ div, px, AbsoluteLength, AnyElement, App, DefiniteLength, Div, Global, Hsla,+ InteractiveElement as _, IntoElement, Length, MouseButton, Pixels, Styled, Window, WindowId,};use gpui_component::{- button::Button, dialog::Dialog, h_flex, ActiveTheme as _, Root, Sizable as _, WindowExt as _,+ button::Button,+ dialog::{AlertDialog, Dialog},+ h_flex, ActiveTheme as _, Root, Sizable as _, WindowExt as _,};+// ---------------- 界面缩放 ----------------++/// 设计稿上的像素值(100% 档的读数),取用时乘当前缩放倍数。尺寸常量一律定义成它;+/// 传给 gpui 的样式方法时经下面的 From 自动换算,参与算术时直接落成 `Pixels`+#[derive(Clone, Copy, Debug)]+pub struct Zpx(pub f32);++/// 表达式里的设计稿像素:`zpx(12.)` 就是当前档位下的 12px+pub fn zpx(value: f32) -> Pixels {+ px(value * crate::ui_zoom::factor())+}++impl Zpx {+ /// 当前档位下的实际像素+ pub fn get(self) -> Pixels {+ zpx(self.0)+ }+}++impl From<Zpx> for Pixels {+ fn from(value: Zpx) -> Self {+ value.get()+ }+}++impl From<Zpx> for AbsoluteLength {+ fn from(value: Zpx) -> Self {+ value.get().into()+ }+}++impl From<Zpx> for DefiniteLength {+ fn from(value: Zpx) -> Self {+ value.get().into()+ }+}++impl From<Zpx> for Length {+ fn from(value: Zpx) -> Self {+ value.get().into()+ }+}++impl From<Zpx> for gpui_component::Size {+ fn from(value: Zpx) -> Self {+ value.get().into()+ }+}++impl From<Zpx> for gpui_component::button::ButtonRounded {+ fn from(value: Zpx) -> Self {+ value.get().into()+ }+}++impl Mul<f32> for Zpx {+ type Output = Pixels;+ fn mul(self, rhs: f32) -> Pixels {+ self.get() * rhs+ }+}++impl Neg for Zpx {+ type Output = Pixels;+ fn neg(self) -> Pixels {+ -self.get()+ }+}++impl<T: Into<Pixels>> Add<T> for Zpx {+ type Output = Pixels;+ fn add(self, rhs: T) -> Pixels {+ self.get() + rhs.into()+ }+}++impl<T: Into<Pixels>> Sub<T> for Zpx {+ type Output = Pixels;+ fn sub(self, rhs: T) -> Pixels {+ self.get() - rhs.into()+ }+}++impl Add<Zpx> for Pixels {+ type Output = Pixels;+ fn add(self, rhs: Zpx) -> Pixels {+ self + rhs.get()+ }+}++impl Sub<Zpx> for Pixels {+ type Output = Pixels;+ fn sub(self, rhs: Zpx) -> Pixels {+ self - rhs.get()+ }+}+/// 产品展示名(About)——medium-pub const FONT_DISPLAY: Pixels = px(28.);+pub const FONT_DISPLAY: Zpx = Zpx(28.);/// 上下文大标题(中栏头部)——semibold-pub const FONT_TITLE: Pixels = px(22.);+pub const FONT_TITLE: Zpx = Zpx(22.);/// 区块标题(详情页会话标题)——semibold-pub const FONT_HEADING: Pixels = px(16.);+pub const FONT_HEADING: Zpx = Zpx(16.);/// 界面正文(导航行/列表标题/按钮/输入);列表标题用 medium-pub const FONT_BODY: Pixels = px(14.);+pub const FONT_BODY: Zpx = Zpx(14.);/// 辅助说明(列表副行/元信息/占位/空态提示/侧栏子级行)-pub const FONT_CAPTION: Pixels = px(12.);+pub const FONT_CAPTION: Zpx = Zpx(12.);/// 标签(分组头/计数/快捷键徽标/状态栏);组头 semibold + 大写-pub const FONT_LABEL: Pixels = px(11.);+pub const FONT_LABEL: Zpx = Zpx(11.);// ---- 对话区附档(详情逐消息渲染,经用户逐轮校准,与六档并存)----/// 用户气泡正文(比 FONT_BODY 收半档,气泡内更紧凑)-pub const FONT_MSG_USER: Pixels = px(13.5);+pub const FONT_MSG_USER: Zpx = Zpx(13.5);/// 助手平铺正文-pub const FONT_MSG_BODY: Pixels = px(13.);+pub const FONT_MSG_BODY: Zpx = Zpx(13.);/// thinking 摘要行(斜体)-pub const FONT_MSG_THINKING: Pixels = px(11.5);+pub const FONT_MSG_THINKING: Zpx = Zpx(11.5);// ---------------- 平台文案 ----------------// 同一处 UI 在不同平台叫不同名字/键(Finder vs File Explorer vs 文件管理器、@@ -120,38 +223,41 @@ trash_copy!("Trash", "Trash");/// ⌘K 面板的唯一绑定串——main.rs 的 bind_keys 与下方徽标同源,改键只动这里pub const SEARCH_KEYSTROKE: &str = "secondary-k";-/// 搜索快捷键徽标,从真实绑定串派生("⌘K"/"Ctrl+K"——secondary→平台键-/// 与显示形制都由 gpui/Kbd 持有,这里零平台知识)+/// 快捷键徽标,从真实绑定串派生("⌘K"/"Ctrl+K"——secondary→平台键与显示形制都由+/// gpui/Kbd 持有,这里零平台知识)。绑定串是写死的常量,解析不了是代码错+pub fn key_hint(keystroke: &str) -> String {+ let key = gpui::Keystroke::parse(keystroke).expect("binding keystrokes parse");+ gpui_component::kbd::Kbd::format(&key)+}++/// 搜索快捷键徽标pub fn search_key_hint() -> &'static str {use std::sync::OnceLock;static HINT: OnceLock<String> = OnceLock::new();- HINT.get_or_init(|| {- let key = gpui::Keystroke::parse(SEARCH_KEYSTROKE).expect("SEARCH_KEYSTROKE parses");- gpui_component::kbd::Kbd::format(&key)- })+ HINT.get_or_init(|| key_hint(SEARCH_KEYSTROKE))}// ---------------- 间距与结构 -----------------// 间距刻度:4px 网格。新代码一律引用常量或显式 px();+// 间距刻度:4px 网格。新代码一律引用常量或显式 zpx();// 注意 gpui 的 rem 间距类有幽灵值(rem=14px 下 p_2p5=8.75px、p_3=10.5px,// 均不在网格上)——对齐敏感处禁止使用,存量逐步迁移。-pub const SPACE_XS: Pixels = px(4.);-pub const SPACE_SM: Pixels = px(8.);-pub const SPACE_MD: Pixels = px(12.);-pub const SPACE_LG: Pixels = px(16.);-pub const SPACE_XL: Pixels = px(20.);-pub const SPACE_XXL: Pixels = px(24.);+pub const SPACE_XS: Zpx = Zpx(4.);+pub const SPACE_SM: Zpx = Zpx(8.);+pub const SPACE_MD: Zpx = Zpx(12.);+pub const SPACE_LG: Zpx = Zpx(16.);+pub const SPACE_XL: Zpx = Zpx(20.);+pub const SPACE_XXL: Zpx = Zpx(24.);/// 图标 / 品牌图与紧随其后的文字之间的间距——全应用只此一个值(侧栏行与组头、列表/// 元信息行、详情与阅读面头部及元信息行、⌘K 结果、Insights 榜单、Open In 菜单、状态行、/// 设置页与清理页的行)。用户 2026-09-22 定统一:原先 4 / 6 / 7 / 8 / 12 各处不一。/// 不在 4px 网格上是有意的——品牌 PNG 没有留白,8px 显得空、4px 又贴;lucide 线条图标/// 自带约 1.5px 留白,6px 几何间距视觉上约 7.5px。卡片级的 24px 头像不在此列-pub const ICON_TEXT_GAP: Pixels = px(6.);+pub const ICON_TEXT_GAP: Zpx = Zpx(6.);/// 侧栏容器水平内边距(行的 hover/选中胶囊左右各留这么多)。-pub const SIDEBAR_EDGE: Pixels = px(10.);+pub const SIDEBAR_EDGE: Zpx = Zpx(10.);// ---- 侧栏中轴:LEAD_AXIS = 26.75 ----// traffic light 实测左缘 20、直径 13.5,中心即 26.75。侧栏每一行的行首元素@@ -160,28 +266,31 @@ pub const SIDEBAR_EDGE: Pixels = px(10.);// 图标左缘就会落在 17.75,比红灯左缘还靠左 2.25,这是预期而非错位。// 两个内边距(LEAD_INSET / TITLE_INSET)是同一条轴推出来的,改一个必须重算另一个。+/// 侧栏中轴(100% 档)。界面缩放时 traffic light 跟着它挪(`ui_zoom::traffic_lights`)+pub const LEAD_AXIS: Zpx = Zpx(26.75);+/// 行首槽位:取最大前导元素(品牌图 18px)的尺寸;槽位内**居中**,/// 于是 14/15px 的小图标中心也落在轴上。-pub const LEAD_BOX: Pixels = px(18.);+pub const LEAD_BOX: Zpx = Zpx(18.);/// 侧栏导航行的线条图标边长(品牌图占满 18px 槽位,线条图标比实心品牌图视觉轻,小一档/// 才平衡);组头的折叠 chevron 同一档,描边粗细才一致-pub const NAV_ICON: Pixels = px(15.);+pub const NAV_ICON: Zpx = Zpx(15.);/// 行左内边距 = 26.75(轴) − 9(槽位半宽) − 10(SIDEBAR_EDGE,容器那一半)-pub const LEAD_INSET: Pixels = px(7.75);+pub const LEAD_INSET: Zpx = Zpx(LEAD_AXIS.0 - LEAD_BOX.0 / 2. - SIDEBAR_EDGE.0);/// 分组项(agent/项目)相对轴的右缩进,表达从属。/// 压轴的只有主导航行与组头;分组项一律偏这么多。-pub const SUB_INDENT: Pixels = px(12.);+pub const SUB_INDENT: Zpx = Zpx(12.);// 组头(Agents / Projects)没有自己的内边距常量:NAV_ICON 的 chevron 按自己的框居中压轴//(见 workbench.rs group_header);靠首字母字形宽度反推的 GROUP_HEAD_INSET 已删(2026-09-22)。/// 侧栏标题 "Wake" 的左内边距:同样让首字母 W 的字形中心落在轴上。/// 实测 16px semibold 的 W 宽 14.25、左承距 0.5,文字左缘需 19.65;/// 减去容器的 SIDEBAR_EDGE 得 9.15,取 9.0(2x 屏下 0.5px 以下的差会被光栅化吃掉)。-pub const TITLE_INSET: Pixels = px(9.);+pub const TITLE_INSET: Zpx = Zpx(9.);/// 侧栏主导航行高(固定区:All Sessions/Starred;搜索框同高)-pub const ROW_HEIGHT: Pixels = px(32.);+pub const ROW_HEIGHT: Zpx = Zpx(32.);/// 侧栏子级行高(分组展开项:agent/项目)——比主导航低一级,/// 配 FONT_CAPTION 形成侧栏纵向层级(macOS 原生侧栏惯例)-pub const ROW_HEIGHT_SUB: Pixels = px(26.);+pub const ROW_HEIGHT_SUB: Zpx = Zpx(26.);/// 侧栏搜索入口与局部搜索输入共用的外壳;文字输入本身不再叠加组件默认边框。pub fn search_field_frame(cx: &App) -> Div {@@ -204,7 +313,7 @@ pub fn search_field_frame(cx: &App) -> Div {// 四档见 DESIGN.md:面板 12 = `theme.radius_lg`,列表与侧栏选择 8 = `theme.radius`// (这两档走主题 token),其余三档无 token,在此定名以免散成魔法数字。/// 按钮圆角。**用户钉死 6px,勿改**-pub const RADIUS_BUTTON: Pixels = px(6.);+pub const RADIUS_BUTTON: Zpx = Zpx(6.);/// Page and dialog actions use fixed pixels; the library's rem-based Small/// preset becomes 21px at Wake's 14px rem size and crowds mixed-size footers.@@ -220,25 +329,25 @@ pub fn action_button(button: Button) -> Button {}/// 快捷键标签-pub const RADIUS_KBD: Pixels = px(5.);+pub const RADIUS_KBD: Zpx = Zpx(5.);/// 小胶囊 badge(项目名 / model / source / 各处计数共用)-pub const RADIUS_BADGE: Pixels = px(4.);+pub const RADIUS_BADGE: Zpx = Zpx(4.);/// 对话正文内联图片缩略图。-pub const IMAGE_THUMB: Pixels = px(104.);-pub const RADIUS_IMAGE: Pixels = px(10.);+pub const IMAGE_THUMB: Zpx = Zpx(104.);+pub const RADIUS_IMAGE: Zpx = Zpx(10.);pub const IMAGE_SCRIM: f32 = 0.62;/// 数据可视化小色块(热力图、分布柱、图例),统一保持方格读数感。-pub const RADIUS_CELL: Pixels = px(2.);+pub const RADIUS_CELL: Zpx = Zpx(2.);// ---------------- 组件度量派生 ----------------/// gpui-component `Size::Small` 按钮的水平内边距(px_3 @ rem14 = 10.5)。/// location 表单的"内容轴"对齐从它派生——组件升级或 rem 基准变更先核此值-pub const BUTTON_SM_PX: Pixels = px(10.5);+pub const BUTTON_SM_PX: Zpx = Zpx(10.5);/// gpui-component `Size::Small` 按钮高度(h_6 = 24),手排胶囊钮取齐用-pub const BUTTON_SM_H: Pixels = px(24.);+pub const BUTTON_SM_H: Zpx = Zpx(24.);/// 页面与确认框操作按钮的高度,避免与组件的 rem 尺寸混用。-pub const BUTTON_ACTION_H: Pixels = px(32.);+pub const BUTTON_ACTION_H: Zpx = Zpx(32.);// ---------------- 交互态文字 ----------------@@ -248,15 +357,15 @@ pub const BUTTON_ACTION_H: Pixels = px(32.);/// 把该元素 base 的字号原样重申;禁止在 hover/active 里裸调 `text_color`/// (图标-only 元素除外:图标尺寸走 `with_size`,不受 text 替换影响)。pub trait TextColored: Styled + Sized {- fn text_colored(self, color: Hsla, size: Pixels) -> Self {- self.text_color(color).text_size(size)+ fn text_colored(self, color: Hsla, size: impl Into<Pixels>) -> Self {+ self.text_color(color).text_size(size.into())}}impl<T: Styled + Sized> TextColored for T {}/// Wake 主窗口的透明标题栏高度。28px 详情操作条上下各保留 8px。-pub const WINDOW_TITLEBAR_HEIGHT: Pixels = px(44.);+pub const WINDOW_TITLEBAR_HEIGHT: Zpx = Zpx(44.);// ---- 弹窗「点面板外关闭」补丁 ----//@@ -279,19 +388,57 @@ pub const WINDOW_TITLEBAR_HEIGHT: Pixels = px(44.);struct ClosableDialogs(HashSet<WindowId>);impl Global for ClosableDialogs {}-/// 打开可点面板外关闭的普通弹窗(确认类用 gpui-component 的 `open_alert_dialog`);-/// Wake 里不要再裸调 `window.open_dialog`-pub fn open_closable_dialog<F>(window: &mut Window, cx: &mut App, build: F)+/// 弹窗宽度:设计稿宽度随缩放放大,但不超出窗口——gpui-component 的 Dialog 不会把+/// 自己夹进窗口,宽出来就两边一起出界(150% 档下 640 宽的弹窗就比最小窗口宽)+fn dialog_width(design: f32, window: &Window) -> Pixels {+ zpx(design).min(window.viewport_size().width - SPACE_XXL * 2.)+}++/// 打开可点面板外关闭的普通弹窗(确认类用 `open_alert`);Wake 里不要再裸调+/// `window.open_dialog` / `open_alert_dialog`。`width` 是设计稿宽度:两个入口都按上面的+/// 规则定宽、把组件写死的 16px 内边距换成随缩放的同值,build 里不必再写 `.w()`+pub fn open_closable_dialog<F>(window: &mut Window, cx: &mut App, width: f32, build: F)whereF: Fn(Dialog, &mut Window, &mut App) -> Dialog + 'static,{window.open_dialog(cx, move |dialog, window, cx| {let id = window.window_handle().window_id();cx.default_global::<ClosableDialogs>().0.insert(id);- build(dialog, window, cx)+ let width = dialog_width(width, window);+ build(dialog.p(SPACE_LG), window, cx).w(width)});}+/// 打开确认类弹窗(gpui-component 的 AlertDialog,面板外点击不关),尺寸规则同上+pub fn open_alert<F>(window: &mut Window, cx: &mut App, width: f32, build: F)+where+ F: Fn(AlertDialog, &mut Window, &mut App) -> AlertDialog + 'static,+{+ window.open_alert_dialog(cx, move |dialog, window, cx| {+ let width = dialog_width(width, window);+ build(dialog.p(SPACE_LG), window, cx).width(width)+ });+}++/// 定宽栏(侧栏、会话流、设置侧栏,合计设计宽 `rails`)的缩放倍数:跟着界面缩放放大,+/// 但给窗口其余部分留出它们在 100% 档最小窗口里拿到的宽度(`min_window − rails`)——+/// 窗口最小尺寸只在开窗那一刻定、运行时改不了,档位一高就能把其余部分挤没;不够宽时+/// 等比收窄,最窄退回 100%+pub fn rails_factor(rails: f32, viewport_width: Pixels, min_window: Pixels) -> f32 {+ rails_factor_at(+ rails,+ f32::from(viewport_width),+ f32::from(min_window),+ crate::ui_zoom::factor(),+ )+}++fn rails_factor_at(rails: f32, viewport_width: f32, min_window: f32, factor: f32) -> f32 {+ ((viewport_width - (min_window - rails)) / rails)+ .min(factor)+ .max(1.)+}+/// 窗口根节点内容之后的三层 overlay:dialog、notification、点面板外关闭的 sentinel,/// 顺序即契约(sentinel 必须在 dialog 层之后,才能盖在它的 occlude 层上面)pub fn overlay_layers(window: &mut Window, cx: &mut App) -> Vec<AnyElement> {@@ -321,3 +468,123 @@ pub fn overlay_layers(window: &mut Window, cx: &mut App) -> Vec<AnyElement> {.flatten().collect()}++#[cfg(test)]+mod tests {+ use super::rails_factor_at;++ /// 非测试代码里裸 `px(` 的个数(`zpx(`、`.px(` 之类不算);`#[cfg(test)]` 的模块按+ /// 花括号配对跳过+ fn bare_px_count(src: &str) -> usize {+ let mut count = 0;+ let mut depth: Option<i32> = None;+ let mut gated = false;+ for line in src.lines() {+ let trimmed = line.trim_start();+ let delta = line.matches('{').count() as i32 - line.matches('}').count() as i32;+ if let Some(d) = depth.as_mut() {+ *d += delta;+ if *d <= 0 {+ depth = None;+ }+ continue;+ }+ if trimmed.starts_with("#[cfg(") && trimmed.contains("test") {+ gated = true;+ continue;+ }+ if gated {+ if trimmed.starts_with("#[") {+ continue;+ }+ gated = false;+ let is_mod = ["mod ", "pub mod ", "pub(crate) mod "]+ .iter()+ .any(|head| trimmed.starts_with(head));+ if is_mod && delta > 0 {+ depth = Some(delta);+ continue;+ }+ }+ count += line+ .match_indices("px(")+ .filter(|(at, _)| {+ line[..*at]+ .chars()+ .next_back()+ .is_none_or(|c| !(c.is_alphanumeric() || c == '_' || c == '.'))+ })+ .count();+ }+ count+ }++ /// 裸 `px` 不随界面缩放(issue #51):新增的尺寸要写 `zpx(…)` / `Zpx(…)`。这里按文件+ /// 数一遍,只许减不许增——真该是固定像素的(1px 发丝线、零值、已经按倍数算好的实际+ /// 宽度)就把上限改大,让这个决定在 review 里看得见+ #[test]+ fn bare_pixel_sizes_do_not_creep_back() {+ const FILES: &[(&str, &str, usize)] = &[+ ("workbench.rs", include_str!("workbench.rs"), 17),+ (+ "workbench/memory.rs",+ include_str!("workbench/memory.rs"),+ 1,+ ),+ (+ "workbench/cleanup.rs",+ include_str!("workbench/cleanup.rs"),+ 1,+ ),+ (+ "workbench/cleanup/filter.rs",+ include_str!("workbench/cleanup/filter.rs"),+ 8,+ ),+ (+ "workbench/cleanup/history.rs",+ include_str!("workbench/cleanup/history.rs"),+ 1,+ ),+ (+ "workbench/cleanup/rows.rs",+ include_str!("workbench/cleanup/rows.rs"),+ 0,+ ),+ ("settings.rs", include_str!("settings.rs"), 2),+ ("ui.rs", include_str!("ui.rs"), 1),+ ("ui_zoom.rs", include_str!("ui_zoom.rs"), 2),+ ("main.rs", include_str!("main.rs"), 0),+ ("theme.rs", include_str!("theme.rs"), 0),+ ("markdown_links.rs", include_str!("markdown_links.rs"), 0),+ ];+ for (name, src, limit) in FILES {+ let count = bare_px_count(src);+ assert!(+ count <= *limit,+ "{name}: {count} bare px() calls (limit {limit}); sizes must use zpx()/Zpx to follow \+ the zoom level, or raise the limit if this one really is a fixed pixel"+ );+ }+ }++ #[test]+ fn rails_keep_their_width_at_100_percent() {+ // 主窗:侧栏 224 + 会话流 336,最小窗口 940+ for width in [940., 1200., 2560.] {+ assert_eq!(rails_factor_at(560., width, 940., 1.), 1.);+ }+ }++ #[test]+ fn zoomed_rails_grow_but_leave_the_rest_room() {+ // 窗口够宽:按倍数放大+ assert_eq!(rails_factor_at(560., 2560., 940., 1.5), 1.5);+ // 不够宽:收窄到其余部分留够 380+ let factor = rails_factor_at(560., 1100., 940., 1.5);+ assert!((560. * factor - 720.).abs() < 0.01);+ // 最窄退回 100% 档;设置窗侧栏同一条规则+ assert_eq!(rails_factor_at(560., 940., 940., 1.5), 1.);+ assert_eq!(rails_factor_at(180., 720., 720., 1.5), 1.);+ }+}diff --git a/crates/wake/src/ui_zoom.rs b/crates/wake/src/ui_zoom.rsnew file mode 100644index 0000000..67d2733--- /dev/null+++ b/crates/wake/src/ui_zoom.rs@@ -0,0 +1,208 @@+//! 界面缩放(issue #51):⌘+ / ⌘− / ⌘0、显示菜单与 Settings → Appearance → Zoom。+//!+//! gpui 没有浏览器那种整窗缩放(`Window::set_scale_factor` 只在 test-support 里),+//! Wake 的尺寸又几乎全是显式像素,所以缩放落在两处,倍数同一个:+//! - Wake 自己的尺寸一律经 `ui::zpx` / `ui::Zpx` 取值,乘上这里的倍数;+//! - gpui-component 的组件按 rem 排版,rem 由 Root 每帧按 `theme.font_size` 设,+//! `theme::apply_wake_theme` 把它(连同等宽字号与两档圆角)乘上同一个倍数。+//!+//! 100% 档两边都是乘 1.0,与缩放落地前逐像素相同。档位是进程全局的(主窗与设置窗+//! 一起变),落在 prefs 的 `zoom`:开窗前就要读,与 appearance 同理。++use std::sync::atomic::{AtomicU16, Ordering};++use gpui::{actions, point, px, App, KeyBinding, Pixels, Point, Window};+use gpui_component::{notification::Notification, WindowExt as _};++use crate::ui::{zpx, LEAD_AXIS};++actions!(wake_app, [ZoomIn, ZoomOut, ActualSize]);++/// 可选档位(百分比)。只放大不缩小+pub const LEVELS: [u16; 4] = [100, 110, 125, 150];+pub const DEFAULT: u16 = 100;+const PREF: &str = "zoom";++/// 快捷键:main.rs 的键位(`key_bindings`)与设置页的提示(`key_hints`)同源。`+` 与 `=`+/// 都绑:美式键盘上 ⌘+ 实际按的是 ⌘⇧=,别的布局 + 是单独一键;提示显示第一个+const ZOOM_IN_KEYS: [&str; 2] = ["secondary-+", "secondary-="];+const ZOOM_OUT_KEY: &str = "secondary--";+const ACTUAL_SIZE_KEY: &str = "secondary-0";++/// 两扇窗 traffic light 在 100% 档的顶距。开窗时与换档后挪位共用这一个数+pub const MAIN_LIGHTS_TOP: f32 = 15.;+pub const SETTINGS_LIGHTS_TOP: f32 = 11.;+/// macOS traffic light 红灯的直径一半与按钮框高的一半(实测 13.5 / 14)+const LIGHT_HALF_W: f32 = 6.75;+const LIGHT_HALF_H: f32 = 7.;++static PERCENT: AtomicU16 = AtomicU16::new(DEFAULT);++pub fn percent() -> u16 {+ PERCENT.load(Ordering::Relaxed)+}++/// 当前倍数(1.0 = 100%)+pub fn factor() -> f32 {+ f32::from(percent()) / 100.+}++/// 档位的显示形制("125%"),设置页下拉的按钮与菜单项共用+pub fn label(level: u16) -> String {+ format!("{level}%")+}++/// 读落盘的档位。必须在 `theme::sync_appearance` 与开任何窗之前+pub fn init() {+ if let Some(level) = crate::prefs::read(PREF).as_deref().and_then(parse) {+ PERCENT.store(level, Ordering::Relaxed);+ }+}++/// 只认档位表里的值:手改的偏好文件与去掉了的档位都退回默认+fn parse(text: &str) -> Option<u16> {+ text.trim()+ .parse()+ .ok()+ .filter(|level| LEVELS.contains(level))+}++/// 相邻档位,到头给 None+fn step(from: u16, up: bool) -> Option<u16> {+ let ix = LEVELS.iter().position(|&level| level == from)?;+ if up {+ LEVELS.get(ix + 1).copied()+ } else {+ ix.checked_sub(1).map(|ix| LEVELS[ix])+ }+}++/// 换档:落盘 → 改倍数 → 重套主题(rem / 等宽字号 / 圆角)→ 重绘全部窗口;同档早退。+/// 落盘失败不换档(与 appearance、语言一致),通知经 `with_active_window` 推迟后贴到当前+/// 窗口——全局 action 监听器是在派发它的那扇窗口的 update 期间被调用的,那扇窗正被借出+pub fn change(level: u16, cx: &mut App) {+ if level == percent() {+ return;+ }+ if let Err(error) = crate::prefs::write(PREF, level.to_string().as_bytes()) {+ let message = crate::tf!("Couldn't save zoom: {}", error);+ crate::with_active_window(cx, move |window, cx| {+ window.push_notification(Notification::error(message), cx)+ });+ return;+ }+ PERCENT.store(level, Ordering::Relaxed);+ crate::theme::apply_wake_theme(cx);+ cx.refresh_windows();+}++/// 三个缩放 action 挂成**全局**监听器:不管焦点在哪(弹窗里、下拉菜单刚关、两扇窗+/// 哪扇在前,甚至焦点丢了)都得生效——挂在窗口根上的话,焦点一旦不在根的子树里+/// 快捷键与菜单就一起失灵,而缩放档位一高、版式一乱,用户最需要的恰恰是 ⌘0 能回来+/// (2026-10-08 实测踩到)。代价是菜单项到头不置灰(gpui 判可用性时全局监听器恒算+/// 可用),到头时就是什么也不做+pub fn register(cx: &mut App) {+ cx.on_action(|_: &ZoomIn, cx| {+ if let Some(level) = step(percent(), true) {+ change(level, cx)+ }+ });+ cx.on_action(|_: &ZoomOut, cx| {+ if let Some(level) = step(percent(), false) {+ change(level, cx)+ }+ });+ cx.on_action(|_: &ActualSize, cx| change(DEFAULT, cx));+}++/// main.rs 键位表里的三个缩放键(全局,不限 key context)+pub fn key_bindings() -> impl Iterator<Item = KeyBinding> {+ ZOOM_IN_KEYS+ .into_iter()+ .map(|key| KeyBinding::new(key, ZoomIn, None))+ .chain([+ KeyBinding::new(ZOOM_OUT_KEY, ZoomOut, None),+ KeyBinding::new(ACTUAL_SIZE_KEY, ActualSize, None),+ ])+}++/// 三个快捷键的显示形制("⌘+ / ⌘- / ⌘0"、"Ctrl++ / …")。设置页的说明用它:Linux /+/// Windows 没有菜单栏,那里是唯一能看到快捷键的地方+pub fn key_hints() -> &'static str {+ use std::sync::OnceLock;+ static HINTS: OnceLock<String> = OnceLock::new();+ HINTS.get_or_init(|| {+ [ZOOM_IN_KEYS[0], ZOOM_OUT_KEY, ACTUAL_SIZE_KEY]+ .map(crate::ui::key_hint)+ .join(" / ")+ })+}++/// 换过档没有:`seen` 是调用方上次处理时的档位,变了就记下新档位并返回 true。缓存了按+/// 旧倍数量出的尺寸的地方(变高列表的行高、traffic light 坐标)在 render 里每帧问一次+pub fn changed(seen: &mut u16) -> bool {+ let now = percent();+ if *seen == now {+ return false;+ }+ *seen = now;+ true+}++/// macOS traffic light 的位置。`top` 是 100% 档的顶距(`MAIN_LIGHTS_TOP` /+/// `SETTINGS_LIGHTS_TOP`)。灯本身不随缩放变大,但界面是整体放大的:侧栏中轴与顶部+/// 净空都按倍数放大——把灯挪过去,红灯中心仍压在中轴上、仍在净空里垂直居中。+/// 100% 档恰好给回 (20, top)+pub fn traffic_lights(top: f32) -> Point<Pixels> {+ point(+ LEAD_AXIS.get() - px(LIGHT_HALF_W),+ zpx(top + LIGHT_HALF_H) - px(LIGHT_HALF_H),+ )+}++/// 换档后把已开窗口的 traffic light 挪到新位置。只有 macOS 有这个 API(gpui 在别的+/// 平台不编译它,`cfg!` 表达式也会被类型检查,所以必须是属性)+pub fn move_traffic_lights(top: f32, window: &mut Window) {+ #[cfg(target_os = "macos")]+ window.set_traffic_light_position(traffic_lights(top));+ #[cfg(not(target_os = "macos"))]+ let _ = (top, window);+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn steps_walk_the_level_table_and_stop_at_the_ends() {+ assert_eq!(step(100, true), Some(110));+ assert_eq!(step(125, false), Some(110));+ assert_eq!(step(150, true), None);+ assert_eq!(step(100, false), None);+ assert_eq!(step(123, true), None);+ }++ #[test]+ fn saved_levels_must_be_on_the_table() {+ assert_eq!(parse("125\n"), Some(125));+ assert_eq!(parse("175"), None);+ assert_eq!(parse("90"), None);+ assert_eq!(parse("abc"), None);+ assert_eq!(parse(""), None);+ }++ #[test]+ fn traffic_lights_stay_where_they_were_at_100_percent() {+ assert_eq!(factor(), 1.);+ assert_eq!(traffic_lights(MAIN_LIGHTS_TOP), point(px(20.), px(15.)));+ assert_eq!(traffic_lights(SETTINGS_LIGHTS_TOP), point(px(20.), px(11.)));+ }++ #[test]+ fn a_seen_level_reports_each_change_once() {+ let mut seen = 0;+ assert!(changed(&mut seen));+ assert_eq!(seen, percent());+ assert!(!changed(&mut seen));+ }+}diff --git a/crates/wake/src/workbench.rs b/crates/wake/src/workbench.rsindex 03fcec9..2f9254a 100644--- a/crates/wake/src/workbench.rs+++ b/crates/wake/src/workbench.rs@@ -63,6 +63,7 @@ use crate::format::{};use crate::settings::{SettingsPage, SettingsView};use crate::ui::*;+use crate::ui_zoom;use crate::update::{self, UpdateStatus};actions!(@@ -82,21 +83,49 @@ pub const KEY_CONTEXT: &str = "Workbench";/// ⌘K 面板容器的 key context(main.rs 的 ↑↓ 绑定与 dialog 元素共用)pub const PALETTE_CONTEXT: &str = "WakePalette";/// ⌘K 面板内容总高(输入行 + 结果列表 + footer);列表 flex_1 吃剩余空间-const PALETTE_HEIGHT: Pixels = px(492.);+const PALETTE_HEIGHT: Zpx = Zpx(492.);+/// ⌘K 面板顶距(放大后面板高度夹进窗口时同读这个数)+const PALETTE_TOP: Zpx = Zpx(72.);/// location 表单标签列宽(Agent/Folder 两行共用)-const FORM_LABEL_W: Pixels = px(52.);+const FORM_LABEL_W: Zpx = Zpx(52.);/// 左栏顶部由 44px 窗口控制区 + 44px 品牌行组成;中栏标题区共享总高度。-const LIBRARY_IDENTITY_HEIGHT: Pixels = px(88.);+const LIBRARY_IDENTITY_HEIGHT: Zpx = Zpx(88.);/// 侧栏底部常态工具栏内容高;加上父容器 1px 顶部分隔线,总高 44px。-const SIDEBAR_FOOTER_ROW_HEIGHT: Pixels = px(43.);-/// 三栏固定结构宽度;工具摘要需要从窗口宽度反算真实可用空间。-const SIDEBAR_WIDTH: Pixels = px(224.);-const SESSION_STREAM_WIDTH: Pixels = px(336.);-const READER_MAX_WIDTH: Pixels = px(720.);+const SIDEBAR_FOOTER_ROW_HEIGHT: Zpx = Zpx(43.);+/// 三栏固定结构宽度(100% 档);实际宽度走 `Workbench::columns`。工具摘要需要从窗口宽度+/// 反算真实可用空间。+const SIDEBAR_WIDTH: Zpx = Zpx(224.);+const SESSION_STREAM_WIDTH: Zpx = Zpx(336.);+const READER_MAX_WIDTH: Zpx = Zpx(720.);/// FONT_MSG_THINKING 使用等宽字体时,一个 ASCII 显示格的实测近似宽度。-const TOOL_MONO_CELL_WIDTH: f32 = 6.9;+const TOOL_MONO_CELL_WIDTH: Zpx = Zpx(6.9);++#[cfg(test)]+mod week_grid_tests {+ use super::{sidebar_footer_width, WeekGrid, SIDEBAR_WIDTH};+ use gpui::px;++ #[test]+ fn the_footer_fits_the_sidebar_at_100_percent() {+ // 下限只在放大档位下起作用;100% 档侧栏仍是 224+ assert!(sidebar_footer_width() < SIDEBAR_WIDTH.get());+ }++ #[test]+ fn week_grid_keeps_its_size_in_the_narrowest_window_at_100_percent() {+ // 940 − 224 侧栏 − 两侧 24 = 668,100% 档恰好放得下 53 周+ let grid = WeekGrid::fit(px(668.));+ assert_eq!(+ (grid.cell, grid.gap, grid.step(), grid.dow),+ (px(9.), px(3.), px(12.), px(26.))+ );+ // 更窄时只收窄周列,标签列不动+ let narrow = WeekGrid::fit(px(26. + 318.));+ assert_eq!((narrow.step(), narrow.dow), (px(6.), px(26.)));+ }+}/// Insights 主区块间距,明确落在 4px 网格上。-const INSIGHTS_SECTION_GAP: Pixels = px(32.);+const INSIGHTS_SECTION_GAP: Zpx = Zpx(32.);type SharedAdapters = Arc<Vec<Box<dyn AgentAdapter>>>;type SharedLocations = Arc<Vec<AdapterLocation>>;@@ -111,10 +140,11 @@ fn library_header(id: &'static str,title: impl Into<SharedString>,subtitle: impl Into<SharedString>,- inset: Pixels,+ inset: impl Into<Pixels>,actions: Option<AnyElement>,cx: &App,) -> impl IntoElement {+ let inset: Pixels = inset.into();let title: SharedString = title.into();let subtitle: SharedString = subtitle.into();v_flex()@@ -135,7 +165,7 @@ fn library_header(v_flex().flex_1().min_w_0()- .gap(px(2.))+ .gap(zpx(2.)).child(div().truncate()@@ -152,7 +182,7 @@ fn library_header(),).when_some(actions, |row, actions| {- row.child(div().flex_shrink_0().pt(px(2.)).child(actions))+ row.child(div().flex_shrink_0().pt(zpx(2.)).child(actions))}),)}@@ -658,7 +688,7 @@ impl ListDelegate for SessionsDelegate {let depth = row.depth;let child_line_color = theme.muted_foreground.opacity(0.38);// 2px 线的中心与父行 15px Grok 图标的 11.5px 中轴一致。- let child_line_left = SPACE_XS + px(6.5);+ let child_line_left = SPACE_XS + zpx(6.5);Some(// 稳定元素身份必须是 session key:展开插入孩子后,IndexPath 会整体@@ -675,13 +705,13 @@ impl ListDelegate for SessionsDelegate {.py(SPACE_SM).gap(SPACE_XS).when(depth > 0, |this| {- this.pl(px(20.)).child(+ this.pl(zpx(20.)).child(div().absolute().left(child_line_left).top(SPACE_SM).bottom(SPACE_SM)- .w(px(2.))+ .w(zpx(2.)).rounded_full().bg(child_line_color),)@@ -720,19 +750,19 @@ impl ListDelegate for SessionsDelegate {).child(h_flex()- .gap(px(6.))+ .gap(zpx(6.)).when(show_chevron, |this| {this.child(div().id(SharedString::from(format!("session-expand:{toggle_key}")))- .size(px(16.))+ .size(zpx(16.)).flex_shrink_0().flex().items_center().justify_center()- .rounded(px(4.))+ .rounded(zpx(4.)).cursor_pointer().hover(|style| style.bg(theme.muted)).on_mouse_down(@@ -775,7 +805,7 @@ impl ListDelegate for SessionsDelegate {).child(icon("icons/chevron-right.svg")- .with_size(px(13.))+ .with_size(zpx(13.)).text_color(theme.muted_foreground).when(expanded, |icon| {icon.rotate(Radians(@@ -806,14 +836,14 @@ impl ListDelegate for SessionsDelegate {.when(s.pinned, |this| {this.child(icon("icons/pin-filled.svg")- .with_size(px(11.))+ .with_size(zpx(11.)).text_color(theme.primary),)}).when(s.favorite, |this| {this.child(icon("icons/star-filled.svg")- .with_size(px(11.))+ .with_size(zpx(11.)).text_color(rgb(crate::theme::STAR_YELLOW)),)}),@@ -825,7 +855,7 @@ impl ListDelegate for SessionsDelegate {.text_color(theme.muted_foreground).child(img(s.agent.brand_icon(theme.mode.is_dark()))- .size(px(15.))+ .size(zpx(15.)).flex_shrink_0(),).child(badge(@@ -1398,14 +1428,14 @@ impl ListDelegate for SearchDelegate {.w_full().px(SPACE_SM).py(SPACE_SM)- .gap(px(6.))+ .gap(zpx(6.)).child(h_flex().gap(ICON_TEXT_GAP).text_size(FONT_CAPTION).child(img(h.session.agent.brand_icon(theme.mode.is_dark()))- .size(px(15.))+ .size(zpx(15.)).flex_shrink_0(),).child(@@ -1494,26 +1524,26 @@ impl ListDelegate for SearchDelegate {let theme = cx.theme();if self.last_query.trim().is_empty() {return v_flex()- .h(px(250.))+ .h(zpx(250.)).w_full().justify_center().child(empty_state("icons/search.svg",- px(48.),- px(22.),+ zpx(48.),+ zpx(22.),t("Search full conversation text"),t("Matches natural language and code, like \"useEffect(\"."),cx,));}v_flex()- .h(px(250.))+ .h(zpx(250.)).w_full().items_center().justify_center().gap(SPACE_MD).text_color(theme.muted_foreground)- .child(icon("icons/inbox.svg").with_size(px(24.)))+ .child(icon("icons/inbox.svg").with_size(zpx(24.))).child(div().text_size(FONT_BODY)@@ -1643,7 +1673,7 @@ impl DetailState {loading: true,error: None,// Bottom 对齐 = 聊天语义:打开落在最新消息,向上翻历史- msg_list: gpui::ListState::new(0, gpui::ListAlignment::Bottom, px(512.)),+ msg_list: gpui::ListState::new(0, gpui::ListAlignment::Bottom, zpx(512.)),expanded_tools: HashSet::new(),expanded_thinking: HashSet::new(),jump_seq,@@ -1883,7 +1913,7 @@ mod detail_selection_tests {// 真实表单里有个会拿焦点的输入框,照样放一个let input = cx.update(|window, cx| cx.new(|cx| InputState::new(window, cx)));cx.update(|window, cx| {- open_closable_dialog(window, cx, move |dialog, _, _| {+ open_closable_dialog(window, cx, 448., move |dialog, _, _| {dialog.title("Probe").w(px(400.))@@ -1904,7 +1934,7 @@ mod detail_selection_tests {);cx.update(|window, cx| {- open_closable_dialog(window, cx, |dialog, _, _| {+ open_closable_dialog(window, cx, 448., |dialog, _, _| {dialog.title("Probe").w(px(400.))@@ -2151,6 +2181,10 @@ pub struct Workbench {palette_input: Entity<InputState>,/// 上次刷新界面缓存译文时的语言代次(见 `sync_language`)lang_generation: u64,+ /// 上次按缩放档位重量变高列表、挪 traffic light 时的档位(见 `sync_zoom`)+ zoom: u16,+ /// 本帧窗口宽度,render 开头取一次;栏宽(`columns`)与阅读宽(`reader_width`)由它派生+ viewport_width: Pixels,/// 进行中的搜索任务;新输入覆盖旧值即取消过期搜索_palette_search_task: Option<Task<()>>,/// 搜索命中不在首批会话时,按页补齐到命中项;新搜索覆盖旧任务。@@ -2354,8 +2388,8 @@ impl UsageBoard {fn name_w(self) -> Pixels {match self {- Self::Models => px(176.),- _ => px(128.),+ Self::Models => zpx(176.),+ _ => zpx(128.),}}}@@ -2604,6 +2638,8 @@ impl Workbench {palette_list,palette_input,lang_generation: crate::i18n::generation(),+ zoom: ui_zoom::percent(),+ viewport_width: window.viewport_size().width,_palette_search_task: None,_list_seek_task: None,pending_list_selection: None,@@ -2760,6 +2796,42 @@ impl Workbench {});}+ /// 侧栏与会话流(Memory 页的列表栏同宽)的实际宽度:随界面缩放放大,窗口不够宽时+ /// 让位给阅读区(`ui::rails_factor`)。侧栏不窄于底部工具条——它的按钮不收缩,放大档位+ /// 下按比例收窄的侧栏装不下,Settings 会挤进会话流;差额由会话流让出(它的标题与行+ /// 都会截断),两栏合计不变。100% 档下恒为 224 / 336+ fn columns(&self) -> (Pixels, Pixels) {+ let rails = SIDEBAR_WIDTH.0 + SESSION_STREAM_WIDTH.0;+ let scale = rails_factor(+ rails,+ self.viewport_width,+ crate::main_window::MAIN_MIN_SIZE.width,+ );+ let sidebar = px(SIDEBAR_WIDTH.0 * scale).max(sidebar_footer_width());+ (sidebar, px(rails * scale) - sidebar)+ }++ /// 阅读栏宽度:窗口减去它左边的栏(`beside`)与两侧留白,封顶阅读宽+ fn reader_width(&self, beside: Pixels) -> Pixels {+ READER_MAX_WIDTH+ .get()+ .min(self.viewport_width - beside - SPACE_XXL * 2.)+ }++ /// 换过缩放档位:变高列表(对话流、Memory 列表)缓存着按旧倍数量出的行高,按比例+ /// 重量、阅读位置不跳;traffic light 挪到新的中轴上。会话列表与 ⌘K 是等高列表,+ /// 每帧都重量首行,不用管。每帧一次整数比较+ fn sync_zoom(&mut self, window: &mut Window) {+ if !ui_zoom::changed(&mut self.zoom) {+ return;+ }+ ui_zoom::move_traffic_lights(ui_zoom::MAIN_LIGHTS_TOP, window);+ if let Some(detail) = &self.detail {+ detail.msg_list.remeasure();+ }+ self.memory.remeasure();+ }+fn refresh_session_group_date(&mut self, cx: &mut Context<Self>) {let today = Local::now().date_naive();let selected_key = self@@ -3031,12 +3103,14 @@ impl Workbench {workbench.update(cx, |this, _| this.settings_window = None);}let (bounds, display_id) =- crate::main_window::centered_over_main(size(px(820.), px(600.)), cx);+ crate::main_window::centered_over_main(size(zpx(820.), zpx(600.)), cx);let titlebar = if cfg!(target_os = "macos") {TitlebarOptions {title: None,appears_transparent: true,- traffic_light_position: Some(point(px(20.), px(11.))),+ traffic_light_position: Some(crate::ui_zoom::traffic_lights(+ crate::ui_zoom::SETTINGS_LIGHTS_TOP,+ )),}} else {TitlebarOptions {@@ -3050,7 +3124,7 @@ impl Workbench {WindowOptions {titlebar: Some(titlebar),window_bounds: Some(WindowBounds::Windowed(bounds)),- window_min_size: Some(size(px(720.), px(520.))),+ window_min_size: Some(crate::main_window::SETTINGS_MIN_SIZE),display_id,app_id: Some("wake-settings".into()),window_decorations: Some(WindowDecorations::Client),@@ -3135,7 +3209,7 @@ impl Workbench {}).detach();let entity = cx.entity();- open_closable_dialog(window, cx, move |dialog, _window, cx| {+ open_closable_dialog(window, cx, 500., move |dialog, _, cx| {let theme = cx.theme();let field_inset = BUTTON_SM_PX;// 有输入才亮出 Cancel/Add(与 location 表单同规则);Rope 直接扫描,@@ -3155,7 +3229,6 @@ impl Workbench {.font_semibold().child(t("Add remote host")),)- .w(px(500.)).button_props(gpui_component::dialog::DialogButtonProps::default().ok_text(t("Add")),)@@ -3381,7 +3454,7 @@ impl Workbench {let entity = cx.entity();let title: SharedString = title.into();let ok_label: SharedString = ok_label.into();- open_closable_dialog(window, cx, move |dialog, _window, cx| {+ open_closable_dialog(window, cx, 500., move |dialog, _, cx| {let theme = cx.theme();let dark = theme.mode.is_dark();// 内容轴缩进 = small 按钮的水平内边距:字段行/标题/footer 以它为轴,@@ -3414,7 +3487,6 @@ impl Workbench {.font_semibold().child(title.clone()),)- .w(px(500.)).button_props(gpui_component::dialog::DialogButtonProps::default().ok_text(ok_label.clone()),)@@ -3447,7 +3519,7 @@ impl Workbench {.items_center().child(img(sel.brand_icon(dark))- .size(px(14.))+ .size(zpx(14.)).flex_shrink_0(),).child(@@ -3457,12 +3529,12 @@ impl Workbench {).child(icon("icons/chevron-down.svg")- .with_size(px(12.))+ .with_size(zpx(12.)).text_color(theme.muted_foreground),),).dropdown_menu(move |menu, _, _| {- let mut menu = menu.min_w(px(200.));+ let mut menu = menu.min_w(zpx(200.));for a in AgentId::ALL {let cell = sel_cell.clone();// element 变体:菜单项带品牌 PNG@@ -3474,7 +3546,7 @@ impl Workbench {.items_center().child(img(a.brand_icon(dark))- .size(px(14.))+ .size(zpx(14.)).flex_shrink_0(),).child(a.display_name())@@ -3508,7 +3580,7 @@ impl Workbench {Button::new("loc-browse").outline().rounded(RADIUS_BUTTON)- .icon(icon("icons/folder.svg").with_size(px(13.)))+ .icon(icon("icons/folder.svg").with_size(zpx(13.))).tooltip(if pick_files {t("Choose a folder or file")} else {@@ -3545,7 +3617,7 @@ impl Workbench {h_flex().id("loc-remove").h(BUTTON_SM_H)- .pl(BUTTON_SM_PX - px(1.5))+ .pl(BUTTON_SM_PX - zpx(1.5)).pr(BUTTON_SM_PX).rounded(RADIUS_BUTTON).items_center()@@ -3566,7 +3638,7 @@ impl Workbench {}).child(icon("icons/trash-2.svg")- .with_size(px(13.))+ .with_size(zpx(13.)).flex_shrink_0(),).child(t("Remove")),@@ -3591,7 +3663,7 @@ impl Workbench {}).child(icon("icons/folder.svg")- .with_size(px(13.))+ .with_size(zpx(13.)).flex_shrink_0().text_color(theme.muted_foreground),)@@ -4267,7 +4339,7 @@ impl Workbench {cx: &mut Context<Self>,) {let entity = cx.entity();- window.open_alert_dialog(cx, move |dialog, _window, cx| {+ open_alert(window, cx, 440., move |dialog, _, cx| {let name = name.clone();let entity = entity.clone();let theme = cx.theme();@@ -4278,7 +4350,6 @@ impl Workbench {.font_semibold().child(crate::tf!("Remove {}?", name)),)- .width(px(440.)).confirm().button_props(gpui_component::dialog::DialogButtonProps::default()@@ -4515,14 +4586,13 @@ impl Workbench {let list = self.palette_list.clone();let input = self.palette_input.clone();let this = cx.entity();- open_closable_dialog(window, cx, move |dialog, window, cx| {+ open_closable_dialog(window, cx, 680., move |dialog, window, cx| {let theme = cx.theme();let has_query = input.read(cx).text().len() > 0;// 输入框尺寸;清除钮的 suffix 补偿 margin 从它派生,改档自动跟随let input_size = gpui_component::Size::Large;dialog- .w(px(680.))- .margin_top(px(72.))+ .margin_top(PALETTE_TOP)// Dialog 默认内容 padding 24px 四边;水平 20,用户定稿(2026-08-18).px(SPACE_XL).close_button(false)@@ -4546,7 +4616,10 @@ impl Workbench {))// 定高 + 列表 flex_1:输入行/footer 尺寸变化时列表自适应,// 不用手工重算列表高度- .h(PALETTE_HEIGHT)+ // 放大后不超出窗口:顶距与上下留白之外的高度都给它,列表跟着缩+ .h(PALETTE_HEIGHT+ .get()+ .min(window.viewport_size().height - PALETTE_TOP - SPACE_XXL * 2.)).gap(SPACE_MD).child(div()@@ -4559,7 +4632,7 @@ impl Workbench {.with_size(input_size).prefix(icon("icons/search.svg")- .with_size(px(16.))+ .with_size(zpx(16.)).text_color(theme.muted_foreground),)// 清除钮自绘,不用内置 cleanable:内置钮固定@@ -4568,7 +4641,7 @@ impl Workbench {i.suffix(div().id("palette-clear")- .size(px(24.))+ .size(zpx(24.))// 抵消组件对 suffix 区强加的// pr(input_px(size)),它在 p_0// 之后应用盖不掉;不抵消则清除钮@@ -4597,7 +4670,7 @@ impl Workbench {}).child(icon("icons/circle-x.svg")- .with_size(px(16.)),+ .with_size(zpx(16.)),),)})@@ -4836,7 +4909,7 @@ impl Workbench {detail.msg_list = gpui::ListState::new(messages.len(),gpui::ListAlignment::Bottom,- px(512.),+ zpx(512.),);// 搜索跳转:seq → 可见消息下标,滚到视口顶。// FTS 命中的行可能被详情过滤(如空文本),用 >= 落到@@ -4862,7 +4935,7 @@ impl Workbench {detail.images.clear();detail.zoom = None;detail.msg_list =- gpui::ListState::new(0, gpui::ListAlignment::Bottom, px(512.));+ gpui::ListState::new(0, gpui::ListAlignment::Bottom, zpx(512.));detail.error = Some(error.into());}}@@ -5341,7 +5414,7 @@ impl Workbench {}}let entity = cx.entity();- window.open_alert_dialog(cx, move |dialog, _window, cx| {+ open_alert(window, cx, 440., move |dialog, _, cx| {let meta = meta.clone();let keys = keys.clone();let targets = targets.clone();@@ -5358,7 +5431,6 @@ impl Workbench {t("Delete this session?")}),)- .width(px(440.))// 破坏性确认:主按钮点名动作并用 danger 形态,不留裸 "OK"。// .confirm() 必须显式调用——Dialog 只在设了 footer 时才渲染// 按钮行,只挂 on_ok 的弹窗实际无按钮(仅回车可确认)@@ -5471,7 +5543,7 @@ impl Workbench {// 未知、记忆同步与远程同步报不出进度,走不定值滑动let progress = busy.then(|| {let bar = Progress::new("refresh-progress")- .with_size(px(3.))+ .with_size(zpx(3.)).color(theme.primary);let bar = if self.scan.scanning && self.scan.total > 0 {bar.value(self.scan.done as f32 / self.scan.total as f32 * 100.)@@ -5486,13 +5558,13 @@ impl Workbench {.flex_shrink_0().child(Spinner::new()- .with_size(px(12.))+ .with_size(zpx(12.)).color(theme.muted_foreground),).into_any_element()} else {icon("icons/refresh-cw.svg")- .with_size(px(12.))+ .with_size(zpx(12.)).flex_shrink_0().into_any_element()};@@ -5513,7 +5585,7 @@ impl Workbench {.text_color(theme.muted_foreground).child(div()- .size(px(7.))+ .size(zpx(7.)).rounded_full().flex_shrink_0().bg(theme.warning),@@ -5535,7 +5607,7 @@ impl Workbench {let show_titlebar = cfg!(target_os = "macos")|| matches!(window.window_decorations(), Decorations::Client { .. });v_flex()- .w(SIDEBAR_WIDTH)+ .w(self.columns().0).h_full().flex_shrink_0().bg(theme.sidebar)@@ -5609,7 +5681,7 @@ impl Workbench {.items_center().justify_between().child(self.render_page_switch(cx))- .child(h_flex().gap(px(2.)).child(sidebar_tool_btn(+ .child(h_flex().gap(zpx(2.)).child(sidebar_tool_btn("settings",t("Settings"),false,@@ -5643,7 +5715,7 @@ impl Workbench {.on_click(cx.listener(|this, _, window, cx| {this.toggle_search(&ToggleSearch, window, cx)}))- .child(icon("icons/search.svg").with_size(px(13.)).flex_shrink_0())+ .child(icon("icons/search.svg").with_size(zpx(13.)).flex_shrink_0())// flex_1 + min_w_0 + truncate:空间不足时压文案,右侧的 ⌘K// 提示不被挤出侧栏.child(@@ -5820,7 +5892,7 @@ impl Workbench {)};h_flex()- .gap(px(2.))+ .gap(zpx(2.)).child(button("page-sessions",t("Sessions"),@@ -5862,7 +5934,7 @@ impl Workbench {Button::new("refresh").ghost().rounded(RADIUS_BUTTON)- .icon(icon("icons/refresh-cw.svg").with_size(px(16.)))+ .icon(icon("icons/refresh-cw.svg").with_size(zpx(16.))).loading(busy).disabled(busy).tooltip(t("Refresh"))@@ -5906,7 +5978,7 @@ impl Workbench {let sort_menu = Button::new("sort-sessions").ghost().rounded(RADIUS_BUTTON)- .icon(icon("icons/arrow-up-down.svg").with_size(px(16.)))+ .icon(icon("icons/arrow-up-down.svg").with_size(zpx(16.))).tooltip(sort_tooltip).dropdown_menu(move |menu, _, _| {let mk_key = |label: &'static str, key: SortKey| {@@ -5941,7 +6013,7 @@ impl Workbench {});})};- menu.min_w(px(180.))+ menu.min_w(zpx(180.)).item(mk_key(t("Date updated"), SortKey::Updated)).item(mk_key(t("Date created"), SortKey::Created)).item(mk_key(t("Message count"), SortKey::Messages))@@ -5951,7 +6023,7 @@ impl Workbench {}).anchor(Anchor::TopRight);v_flex()- .w(SESSION_STREAM_WIDTH)+ .w(self.columns().1).h_full().flex_shrink_0().bg(theme.colors.list)@@ -6001,8 +6073,8 @@ impl Workbench {.gap(SPACE_LG).child(empty_state("icons/layers.svg",- px(48.),- px(22.),+ zpx(48.),+ zpx(22.),t("Your library is empty"),t("Add a local session location to get started."),cx,@@ -6026,8 +6098,8 @@ impl Workbench {.justify_center().child(empty_state("icons/inbox.svg",- px(48.),- px(22.),+ zpx(48.),+ zpx(22.),t("No matching sessions"),t("Try a different agent, project, or filter."),cx,@@ -6185,31 +6257,31 @@ impl Workbench {.items_center().justify_center().gap(SPACE_XL)- .px(px(56.))- .py(px(52.))+ .px(zpx(56.))+ .py(zpx(52.)).child(gpui::img(image).id("image-zoom-figure").w(shown.width).h(shown.height).rounded(SPACE_SM)- .shadow(vec![zoom_shadow(px(18.), px(48.), 0.45)])+ .shadow(vec![zoom_shadow(zpx(18.), zpx(48.), 0.45)]).on_click(|_, _, cx| cx.stop_propagation()),).child(h_flex().id("image-zoom-actions").flex_shrink_0()- .h(px(40.))+ .h(zpx(40.)).items_center().gap(SPACE_SM).pl(SPACE_LG).pr(SPACE_SM)- .rounded(px(20.))+ .rounded(zpx(20.)).bg(gpui::black().opacity(0.78)).border_1().border_color(gpui::white().opacity(0.13))- .shadow(vec![zoom_shadow(px(8.), px(26.), 0.35)])+ .shadow(vec![zoom_shadow(zpx(8.), zpx(26.), 0.35)]).on_click(|_, _, cx| cx.stop_propagation()).child(div()@@ -6217,11 +6289,11 @@ impl Workbench {.text_color(gpui::white().opacity(0.64)).child(metadata),)- .child(div().w(px(1.)).h(px(16.)).bg(gpui::white().opacity(0.16)))+ .child(div().w(px(1.)).h(zpx(16.)).bg(gpui::white().opacity(0.16))).child(h_flex().id("image-copy")- .size(px(30.))+ .size(zpx(30.)).items_center().justify_center().rounded(RADIUS_BUTTON)@@ -6249,7 +6321,7 @@ impl Workbench {} else {"icons/copy.svg"})- .with_size(px(15.))+ .with_size(zpx(15.)).text_color(if copy_succeeded {success@@ -6262,7 +6334,7 @@ impl Workbench {.child(h_flex().id("image-save")- .size(px(30.))+ .size(zpx(30.)).items_center().justify_center().rounded(RADIUS_BUTTON)@@ -6290,7 +6362,7 @@ impl Workbench {} else {"icons/download.svg"})- .with_size(px(15.))+ .with_size(zpx(15.)).text_color(if save_succeeded {success@@ -6308,10 +6380,10 @@ impl Workbench {.absolute().top(SPACE_LG).right(SPACE_LG)- .size(px(32.))+ .size(zpx(32.)).items_center().justify_center()- .rounded(px(9.))+ .rounded(zpx(9.)).bg(gpui::white().opacity(0.11)).hover(|style| style.bg(gpui::white().opacity(0.2))).cursor_pointer()@@ -6321,7 +6393,7 @@ impl Workbench {.on_click(close_button).child(icon("icons/close.svg")- .with_size(px(15.))+ .with_size(zpx(15.)).text_color(gpui::white().opacity(0.86)),),)@@ -6332,20 +6404,13 @@ impl Workbench {/// gpui::list 的行渲染。在布局阶段经 entity.update 调用(render 已返回,/// lease 已释放,无 double-lease 风险——与 dialog builder 的时机不同)。- fn render_msg_row(- &mut self,- ix: usize,- window: &mut Window,- cx: &mut Context<Self>,- ) -> AnyElement {+ fn render_msg_row(&mut self, ix: usize, cx: &mut Context<Self>) -> AnyElement {// 详情宽度随窗口变化;工具头要用当前可用像素反算显示格数,再交给// unicode-width 截断,避免窄窗口溢出、宽窗口仍停在固定长度。- let reader_width =- (window.viewport_size().width - SIDEBAR_WIDTH - SESSION_STREAM_WIDTH - SPACE_XXL * 2.)- .clamp(px(220.), READER_MAX_WIDTH);- let tool_summary_width = (reader_width - px(156.)).max(px(80.));- let tool_arg_cells =- ((f32::from(tool_summary_width) / TOOL_MONO_CELL_WIDTH) as usize).max(8);+ let (sidebar, stream) = self.columns();+ let reader_width = self.reader_width(sidebar + stream).max(zpx(220.));+ let tool_summary_width = (reader_width - zpx(156.)).max(zpx(80.));+ let tool_arg_cells = ((tool_summary_width / TOOL_MONO_CELL_WIDTH.get()) as usize).max(8);let theme = cx.theme();let dark = theme.mode.is_dark();// 尾部要用的 Copy 值提前取出,theme 借用不跨越 inner 构建期的 &mut cx@@ -6387,7 +6452,7 @@ impl Workbench {MessageRole::User => {let has_text = !m.text.trim().is_empty();let mut bubble = v_flex()- .max_w(px(540.))+ .max_w(zpx(540.)).min_w_0().gap(SPACE_SM).rounded(theme.radius_lg)@@ -6395,9 +6460,9 @@ impl Workbench {.text_size(FONT_MSG_USER).line_height(relative(1.85));bubble = if !shots.is_empty() && !has_text {- bubble.p(px(7.))+ bubble.p(zpx(7.))} else {- bubble.px(px(14.)).py(SPACE_SM)+ bubble.px(zpx(14.)).py(SPACE_SM)};// 气泡靠内容撑宽,各段直接挂在气泡上、中间不加任何包装层//(原因见 message_content 的文档注释)@@ -6549,8 +6614,8 @@ impl Workbench {.justify_center().child(empty_state_card("icons/chart-column.svg",- px(58.),- px(24.),+ zpx(58.),+ zpx(24.),t("No activity yet"),t("Refresh sessions to see your activity here."),cx,@@ -6577,14 +6642,18 @@ impl Workbench {fn render_insights_content(&self, d: &InsightsData, cx: &Context<Self>) -> AnyElement {let theme = cx.theme();+ let grid = WeekGrid::fit(self.reader_width(self.columns().0));// ---- 概览大数字行 ----// 序:Sessions / Tokens / Prompts / Agents / Projects / Active days// (用户钉的)let stat =|value: String, label: &'static str| stat_cell(value, label, FONT_TITLE, None, cx);+ // 放不下就换行(放大档位 + 窄窗口);100% 档的宽度下仍是一行let overview = h_flex()- .gap(px(40.))+ .flex_wrap()+ .gap_x(zpx(40.))+ .gap_y(SPACE_LG).child(stat(thousands(d.sessions), t("Sessions"))).when(d.tokens > 0, |row| {row.child(stat(fmt_tokens(Some(d.tokens)), t("Tokens")))@@ -6602,7 +6671,7 @@ impl Workbench {(Some(icon("icons/folder.svg")- .with_size(px(14.))+ .with_size(zpx(14.)).text_color(muted).into_any_element(),),@@ -6622,7 +6691,7 @@ impl Workbench {.w_full().max_w(READER_MAX_WIDTH).pt(SPACE_SM)- .pb(px(40.))+ .pb(zpx(40.)).gap(INSIGHTS_SECTION_GAP).child(overview).child(render_week_section(d, cx))@@ -6635,9 +6704,10 @@ impl Workbench {None,cx,))- .child(render_heatmap(d, cx)),+ .child(render_heatmap(d, grid, cx)),)- .child(self.render_trend_section(d, cx))+ // 与热力图同一个 grid:两图周列上下对齐靠的是同一个值+ .child(self.render_trend_section(d, grid, cx)).child(self.render_distribution_section(d, cx)).child(self.render_usage_section(UsageBoard::Agents,@@ -6712,7 +6782,12 @@ impl Workbench {/// 趋势区块:近 53 周每周 prompts 按 agent 堆叠。不按模型出图——/// messages 表没有逐条 model,会话级 model 是末态,切周即改写历史- fn render_trend_section(&self, d: &InsightsData, cx: &Context<Self>) -> AnyElement {+ fn render_trend_section(+ &self,+ d: &InsightsData,+ grid: WeekGrid,+ cx: &Context<Self>,+ ) -> AnyElement {let layers = trend_layers(&d.trend_agents, cx);v_flex().gap(SPACE_MD)@@ -6722,7 +6797,7 @@ impl Workbench {None,cx,))- .child(render_trend(d.trend_start(), layers, cx))+ .child(render_trend(d.trend_start(), layers, grid, cx)).into_any_element()}@@ -6907,14 +6982,15 @@ impl Workbench {let Some(detail) = &self.detail else {return v_flex().flex_1()+ .min_w_0().h_full().items_center().justify_center().bg(theme.background).child(empty_state_card("icons/message-square.svg",- px(58.),- px(26.),+ zpx(58.),+ zpx(26.),t("No session selected"),crate::tf!("Pick one from the list, or press {} to search.",@@ -6947,7 +7023,7 @@ impl Workbench {} else {"icons/copy.svg"})- .with_size(px(16.)),+ .with_size(zpx(16.)),).tooltip(if path_copied {t("Copied")@@ -6968,15 +7044,15 @@ impl Workbench {let more_menu = Button::new("more-actions").ghost().rounded(RADIUS_BUTTON)- .icon(icon("icons/more-horizontal.svg").with_size(px(16.)))+ .icon(icon("icons/more-horizontal.svg").with_size(zpx(16.))).dropdown_menu(move |menu, _, cx| {let export_entity = export_entity.clone();let reveal_entity = reveal_entity.clone();let delete_entity = delete_entity.clone();- menu.min_w(px(210.))+ menu.min_w(zpx(210.)).item(PopupMenuItem::new(t(" Export as Markdown"))- .icon(icon("icons/download.svg").with_size(px(15.)))+ .icon(icon("icons/download.svg").with_size(zpx(15.))).on_click(move |_, window, cx| {export_entity.update(cx, |this, cx| {this.do_export(window, cx);@@ -6985,7 +7061,7 @@ impl Workbench {).item(PopupMenuItem::new(format!(" {}", reveal_in_fm()))- .icon(icon("icons/folder.svg").with_size(px(15.)))+ .icon(icon("icons/folder.svg").with_size(zpx(15.))).on_click(move |_, _, cx| {reveal_entity.update(cx, |this, _| {if let Some(detail) = &this.detail {@@ -6996,7 +7072,7 @@ impl Workbench {).item(PopupMenuItem::new(t(" Copy Session ID"))- .icon(icon("icons/copy.svg").with_size(px(15.)))+ .icon(icon("icons/copy.svg").with_size(zpx(15.))).on_click({let id = session_id.clone();move |_, _, cx| {@@ -7010,7 +7086,7 @@ impl Workbench {// 一样不弹通知.item(PopupMenuItem::new(t(" Copy Handoff"))- .icon(icon("icons/copy.svg").with_size(px(15.)))+ .icon(icon("icons/copy.svg").with_size(zpx(15.))).on_click({let key = session_key.clone();let title = session_title.clone();@@ -7029,7 +7105,7 @@ impl Workbench {}).icon(icon("icons/trash-2.svg")- .with_size(px(15.))+ .with_size(zpx(15.)).text_color(cx.theme().danger),).on_click(move |_, window, cx| {@@ -7086,11 +7162,11 @@ impl Workbench {lead.push(Button::new("cleanup-back").ghost()- .h(px(28.))+ .h(zpx(28.)).px(SPACE_SM).text_size(FONT_CAPTION).rounded(RADIUS_BUTTON)- .icon(icon("icons/chevron-left.svg").with_size(px(15.)))+ .icon(icon("icons/chevron-left.svg").with_size(zpx(15.))).label(t("Back")).tooltip(t("Back to cleanup list")).on_click(cx.listener(|this, _, window, cx| {@@ -7101,7 +7177,7 @@ impl Workbench {}lead.push(img(meta.agent.brand_icon(theme.mode.is_dark()))- .size(px(15.))+ .size(zpx(15.)).flex_shrink_0().into_any_element(),);@@ -7119,7 +7195,7 @@ impl Workbench {.gap(ICON_TEXT_GAP).child(icon("icons/git-branch.svg")- .with_size(px(11.))+ .with_size(zpx(11.)).flex_shrink_0(),).child(div().min_w_0().truncate().child(branch))@@ -7138,8 +7214,8 @@ impl Workbench {// 要双段共壳)。本地会话即便只剩一个终端也走 split// 按钮,品牌图标与 per-agent 记忆不丢crate::settings::settings_button(Button::new("open-in-single"), cx)- .h(px(28.))- .icon(icon("icons/terminal.svg").with_size(px(13.)))+ .h(zpx(28.))+ .icon(icon("icons/terminal.svg").with_size(zpx(13.))).label(t("Copy SSH command")).tooltip(t("Copy the SSH command that resumes this session on its host",@@ -7170,7 +7246,7 @@ impl Workbench {// 无常显分隔线,hover 分段高亮暗示两段(Codex 同款);// 右段 Button 用 custom variant 与左段 hover 完全一致h_flex()- .h(px(28.))+ .h(zpx(28.)).rounded(RADIUS_BUTTON).border_1().border_color(theme.border)@@ -7180,7 +7256,7 @@ impl Workbench {div().id("open-in-main").h_full()- .px(px(7.))+ .px(zpx(7.)).flex().items_center().cursor_pointer()@@ -7190,7 +7266,7 @@ impl Workbench {current,current_icon.as_ref(),icon("icons/terminal.svg")- .with_size(px(13.))+ .with_size(zpx(13.)).text_color(theme.secondary_foreground),)).tooltip({@@ -7236,12 +7312,12 @@ impl Workbench {.active(theme.secondary_active),).rounded(px(0.))- .h(px(26.))- .w(px(22.))- .icon(icon("icons/chevron-down.svg").with_size(px(12.)))+ .h(zpx(26.))+ .w(zpx(22.))+ .icon(icon("icons/chevron-down.svg").with_size(zpx(12.))).tooltip(t("Open this session in…")).dropdown_menu(move |menu, _, _| {- let mut menu = menu.min_w(px(170.));+ let mut menu = menu.min_w(zpx(170.));for (term, icon_path) in term_items.clone() {let entity = menu_entity.clone();menu = menu.item(@@ -7252,7 +7328,7 @@ impl Workbench {.child(open_in_icon(Some(term),icon_path.as_ref(),- icon("icons/terminal.svg").with_size(px(15.)),+ icon("icons/terminal.svg").with_size(zpx(15.)),)).child(term.display_name())})@@ -7340,7 +7416,7 @@ impl Workbench {h_flex().min_w_0().gap(ICON_TEXT_GAP)- .child(icon("icons/folder.svg").with_size(px(12.)).flex_shrink_0())+ .child(icon("icons/folder.svg").with_size(zpx(12.)).flex_shrink_0()).child(div().min_w_0().truncate().child(detail_path)).into_any_element(),];@@ -7356,7 +7432,7 @@ impl Workbench {.items_center().child(icon("icons/calendar.svg")- .with_size(px(12.))+ .with_size(zpx(12.)).flex_shrink_0(),).child(@@ -7431,12 +7507,12 @@ impl Workbench {.child(v_flex().w_full()- .max_w(px(520.))+ .max_w(zpx(520.)).items_center().gap(SPACE_MD).child(icon("icons/circle-x.svg")- .with_size(px(24.))+ .with_size(zpx(24.)).text_color(theme.danger),).child(@@ -7460,7 +7536,7 @@ impl Workbench {.outline().small().rounded(RADIUS_BUTTON)- .icon(icon("icons/folder.svg").with_size(px(13.)))+ .icon(icon("icons/folder.svg").with_size(zpx(13.))).label(reveal_in_fm()).on_click(move |_, _, _| {terminal::reveal_in_file_manager(&reveal_path)@@ -7476,12 +7552,10 @@ impl Workbench {.bg(theme.popover).relative().child(- gpui::list(detail.msg_list.clone(), move |ix, window, cx| {+ gpui::list(detail.msg_list.clone(), move |ix, _, cx| {entity.upgrade()- .map(|e| {- e.update(cx, |this, cx| this.render_msg_row(ix, window, cx))- })+ .map(|e| e.update(cx, |this, cx| this.render_msg_row(ix, cx))).unwrap_or_else(|| div().into_any_element())}).size_full(),@@ -7574,14 +7648,14 @@ fn insight_arrows(Button::new((id, 0usize)).ghost().rounded(RADIUS_BUTTON)- .icon(icon("icons/chevron-left.svg").with_size(px(14.)))+ .icon(icon("icons/chevron-left.svg").with_size(zpx(14.))).tooltip(t("Previous view")).on_click(on_prev),).when_some(label, |row, label| {row.child(div()- .w(px(64.))+ .w(zpx(64.)).flex().justify_center().whitespace_nowrap()@@ -7594,7 +7668,7 @@ fn insight_arrows(Button::new((id, 1usize)).ghost().rounded(RADIUS_BUTTON)- .icon(icon("icons/chevron-right.svg").with_size(px(14.)))+ .icon(icon("icons/chevron-right.svg").with_size(zpx(14.))).tooltip(t("Next view")).on_click(on_next),)@@ -7621,7 +7695,7 @@ fn switch_section_head(}).child(v_flex()- .gap(px(2.))+ .gap(zpx(2.)).child(div().text_size(FONT_BODY)@@ -7661,7 +7735,7 @@ fn usage_bar_row(.when_some(lead, |row, lead| {row.child(div()- .w(px(15.))+ .w(zpx(15.)).flex_shrink_0().flex().items_center()@@ -7682,7 +7756,7 @@ fn usage_bar_row(.child(div().flex_1()- .h(px(6.))+ .h(zpx(6.)).rounded_full().bg(theme.muted).child(@@ -7695,7 +7769,7 @@ fn usage_bar_row().child(div()- .w(px(56.))+ .w(zpx(56.)).flex_shrink_0().flex().justify_end()@@ -7787,9 +7861,9 @@ fn render_distribution(range: InsightsRange, values: &[i64], peak: usize, cx: &Alet theme = cx.theme();let max = values.iter().copied().max().unwrap_or(0).max(1);let gap = match range {- InsightsRange::Hour => px(4.),- InsightsRange::Weekday => px(8.),- InsightsRange::Month => px(6.),+ InsightsRange::Hour => zpx(4.),+ InsightsRange::Weekday => zpx(8.),+ InsightsRange::Month => zpx(6.),};const CHART_H: f32 = 72.;// 两张名表在逐柱闭包**之外**取一次:闭包体每根柱跑一遍,放进去就是@@ -7805,20 +7879,20 @@ fn render_distribution(range: InsightsRange, values: &[i64], peak: usize, cx: &AInsightsRange::Month => month_short().into(),};v_flex()- .gap(px(6.))+ .gap(zpx(6.)).child(h_flex().items_end().gap(gap)- .h(px(CHART_H))+ .h(zpx(CHART_H)).children((0..values.len()).map(|i| {let n = values[i];let (height, bg) = if n == 0 {- (px(2.), theme.muted)+ (zpx(2.), theme.muted)} else {let frac = (n as f32 / max as f32).max(0.05);(- px((frac * CHART_H).max(3.)),+ zpx((frac * CHART_H).max(3.)),if i == peak {theme.primary} else {@@ -7875,15 +7949,45 @@ const WEEK_STEP: f32 = WEEK_CELL + WEEK_GAP;/// 热力图左侧星期标签列宽;趋势图同样留出这一列,周列才对齐const DOW_W: f32 = 26.;+/// 两张周图的实际几何。100% 档的格子乘界面缩放倍数;阅读栏放不下 TREND_WEEKS 列时+/// (放大档位 + 窄窗口)只把周列等比收窄,星期标签列保持字号所需的宽度。100% 档下+/// 最小窗口的内容宽 668 恰好放得下(见 render_heatmap 的注释),所以不变+#[derive(Clone, Copy)]+struct WeekGrid {+ cell: Pixels,+ gap: Pixels,+ dow: Pixels,+}++impl WeekGrid {+ /// 相邻两列(两行)的间距+ fn step(&self) -> Pixels {+ self.cell + self.gap+ }++ fn fit(content_width: Pixels) -> Self {+ let zoom = ui_zoom::factor();+ let dow = DOW_W * zoom;+ // 标签列之后:一个间距 + 53 格 + 52 个间距 = 53 个步距+ let weeks = TREND_WEEKS as f32 * WEEK_STEP;+ let scale = ((f32::from(content_width) - dow) / weeks).clamp(0., zoom);+ Self {+ cell: px(WEEK_CELL * scale),+ gap: px(WEEK_GAP * scale),+ dow: px(dow),+ }+ }+}+/// 月份刻度行:该列周一进入新月份时标注(与前一周比,首列同规则,相邻标签/// 由此天然隔开 ≥4 列不会叠)。热力图与趋势图共用同一行-fn month_ticks(start: chrono::NaiveDate, cx: &App) -> Div {+fn month_ticks(start: chrono::NaiveDate, grid: WeekGrid, cx: &App) -> Div {use chrono::Datelike as _;let theme = cx.theme();let mut months = div().relative().w_full()- .h(px(14.))+ .h(zpx(14.)).text_size(FONT_LABEL).text_color(theme.muted_foreground);let names = month_short();@@ -7894,7 +7998,7 @@ fn month_ticks(start: chrono::NaiveDate, cx: &App) -> Div {div().absolute().top_0()- .left(px(DOW_W + WEEK_GAP + c as f32 * WEEK_STEP))+ .left(grid.dow + grid.gap + grid.step() * c as f32).child(names[monday.month0() as usize].clone()),);}@@ -7907,16 +8011,16 @@ fn month_ticks(start: chrono::NaiveDate, cx: &App) -> Div {fn stat_cell(value: String,label: &'static str,- size: Pixels,+ size: impl Into<Pixels>,note: Option<(SharedString, Hsla)>,cx: &App,) -> impl IntoElement {let theme = cx.theme();v_flex()- .gap(px(2.))+ .gap(zpx(2.)).child(div()- .text_size(size)+ .text_size(size.into()).font_semibold().text_color(theme.foreground).child(value),@@ -7943,7 +8047,7 @@ fn agent_label(raw: &str) -> SharedString {/// Wake 共用,"一行 agent 长什么样"只此一处fn agent_row_head(name: &str, dark: bool) -> (Option<AnyElement>, SharedString) {(- AgentId::from_str(name).map(|a| img(a.brand_icon(dark)).size(px(15.)).into_any_element()),+ AgentId::from_str(name).map(|a| img(a.brand_icon(dark)).size(zpx(15.)).into_any_element()),agent_label(name),)}@@ -8053,7 +8157,7 @@ fn render_week_section(d: &InsightsData, cx: &App) -> AnyElement {)).child(h_flex()- .gap(px(40.))+ .gap(zpx(40.)).items_start().child(stat(t("Sessions"), cur.sessions, prev.sessions, &thousands)).child(stat(t("Prompts"), cur.prompts, prev.prompts, &thousands))@@ -8070,7 +8174,12 @@ fn render_week_section(d: &InsightsData, cx: &App) -> AnyElement {/// 堆叠周柱图:TREND_WEEKS 列与热力图同宽同步距(左侧留出热力图的星期标签/// 列,两图的周列上下对齐),每列 = 各层该周 prompts 自下而上堆叠,按窗口内/// 峰值周归一;零周留 2px muted 基线。图例列出各层-fn render_trend(start: chrono::NaiveDate, layers: Rc<Vec<TrendLayer>>, cx: &App) -> AnyElement {+fn render_trend(+ start: chrono::NaiveDate,+ layers: Rc<Vec<TrendLayer>>,+ grid: WeekGrid,+ cx: &App,+) -> AnyElement {let theme = cx.theme();const CHART_H: f32 = 72.;let totals: Vec<i64> = (0..TREND_WEEKS)@@ -8080,29 +8189,29 @@ fn render_trend(start: chrono::NaiveDate, layers: Rc<Vec<TrendLayer>>, cx: &App)let mut columns = h_flex().items_end()- .gap(px(WEEK_GAP))- .h(px(CHART_H))- .child(div().w(px(DOW_W)).flex_shrink_0());+ .gap(grid.gap)+ .h(zpx(CHART_H))+ .child(div().w(grid.dow).flex_shrink_0());for w in 0..TREND_WEEKS {let total = totals[w];let column = if total == 0 {div()- .w(px(WEEK_CELL))- .h(px(2.))+ .w(grid.cell)+ .h(zpx(2.)).rounded(RADIUS_CELL).bg(theme.muted)} else {let col_h = ((total as f32 / max as f32) * CHART_H).max(3.);// DOM 自上而下 = 视觉自上而下:Other/末层在顶,首层在底let mut col = v_flex()- .w(px(WEEK_CELL))- .h(px(col_h))+ .w(grid.cell)+ .h(zpx(col_h)).justify_end().rounded(RADIUS_CELL).overflow_hidden();for l in layers.iter().rev().filter(|l| l.weekly[w] > 0) {let h = (l.weekly[w] as f32 / total as f32) * col_h;- col = col.child(div().w_full().h(px(h)).bg(l.color));+ col = col.child(div().w_full().h(zpx(h)).bg(l.color));}col};@@ -8135,21 +8244,21 @@ fn render_trend(start: chrono::NaiveDate, layers: Rc<Vec<TrendLayer>>, cx: &App).flex_wrap().gap_x(SPACE_MD).gap_y(SPACE_XS)- .pl(px(DOW_W + WEEK_GAP))+ .pl(grid.dow + grid.gap).text_size(FONT_LABEL).text_color(theme.muted_foreground).children(layers.iter().map(|l| {h_flex()- .gap(px(5.))+ .gap(zpx(5.)).items_center()- .child(div().size(px(WEEK_CELL)).rounded(RADIUS_CELL).bg(l.color))+ .child(div().size(zpx(WEEK_CELL)).rounded(RADIUS_CELL).bg(l.color)).child(l.name.clone())}));v_flex()- .gap(px(6.))+ .gap(zpx(6.)).child(columns)- .child(month_ticks(start, cx))+ .child(month_ticks(start, grid, cx)).child(legend).into_any_element()}@@ -8164,7 +8273,7 @@ const HEAT: [f32; 4] = [0.25, 0.5, 0.75, 1.];/// 两侧 24 padding)——10px 格的 715 会在最小窗口被裁掉右缘/// (2026-08-27 Codex review)。daily 升序,二分出窗口后填定长数组——/// 渲染路径零哈希零日期运算;tooltip 文案 hover 才格式化-fn render_heatmap(d: &InsightsData, cx: &App) -> AnyElement {+fn render_heatmap(d: &InsightsData, grid: WeekGrid, cx: &App) -> AnyElement {let theme = cx.theme();let today = d.as_of;let start = d.trend_start();@@ -8188,18 +8297,17 @@ fn render_heatmap(d: &InsightsData, cx: &App) -> AnyElement {let quartile = ((n as f32 / heat_max as f32) * 4.).ceil().clamp(1., 4.) as usize;theme.primary.opacity(HEAT[quartile - 1])};- const CELL: f32 = WEEK_CELL;- const GAP: f32 = WEEK_GAP;- const STEP: f32 = WEEK_STEP;+ let WeekGrid { cell, gap, dow } = grid;+ let step = grid.step();- let months = month_ticks(start, cx);+ let months = month_ticks(start, grid, cx);// 星期标签列:行 r 的格子 y = r×STEP,文字行高 ≈13px,// (CELL−13)/2 = −2 光学对行let dow_col = div().relative()- .w(px(DOW_W))- .h(px(7. * STEP - GAP))+ .w(dow)+ .h(step * 7. - gap).flex_shrink_0().text_size(FONT_LABEL).text_color(theme.muted_foreground)@@ -8208,26 +8316,26 @@ fn render_heatmap(d: &InsightsData, cx: &App) -> AnyElement {[0usize, 2, 4].map(|r| {div().absolute()- .top(px(r as f32 * STEP - 2.))+ .top(step * r as f32 - zpx(2.)).left_0().child(names[r])})});- let mut grid = h_flex().gap(px(GAP)).items_start().child(dow_col);+ let mut columns = h_flex().gap(gap).items_start().child(dow_col);for c in 0..TREND_WEEKS {- let mut col = v_flex().gap(px(GAP));+ let mut col = v_flex().gap(gap);for r in 0..7usize {let ix = c * 7 + r;if ix as i64 > today_ix {- col = col.child(div().size(px(CELL)));+ col = col.child(div().size(cell));continue;}let n = window[ix];col = col.child(div().id(("hm", ix))- .size(px(CELL))+ .size(cell).rounded(RADIUS_CELL).bg(heat_color(n))// 只捕获 Copy 的 (start, ix, n),hover 到的那格才格式化@@ -8240,7 +8348,7 @@ fn render_heatmap(d: &InsightsData, cx: &App) -> AnyElement {}),);}- grid = grid.child(col);+ columns = columns.child(col);}// 底注:streak/最忙一天(左) + Less…More 图例(右)@@ -8266,12 +8374,12 @@ fn render_heatmap(d: &InsightsData, cx: &App) -> AnyElement {.child(div().min_w_0().truncate().child(notes.join(" · "))).child(h_flex()- .gap(px(GAP))+ .gap(gap).items_center().flex_shrink_0().child(t("Less")).children(std::iter::once(0.).chain(HEAT).map(|a: f32| {- div().size(px(CELL)).rounded(RADIUS_CELL).bg(if a == 0. {+ div().size(cell).rounded(RADIUS_CELL).bg(if a == 0. {theme.muted} else {theme.primary.opacity(a)@@ -8281,9 +8389,9 @@ fn render_heatmap(d: &InsightsData, cx: &App) -> AnyElement {);v_flex()- .gap(px(6.))+ .gap(zpx(6.)).child(months)- .child(grid)+ .child(columns).child(div().pt(SPACE_XS).child(legend)).into_any_element()}@@ -8299,8 +8407,10 @@ fn empty_state_card(cx: &App,) -> Div {let theme = cx.theme();+ // 宽 360,但栏比它窄时跟着收(放大档位下阅读区可能只剩 380)div()- .w(px(360.))+ .w_full()+ .max_w(zpx(360.)).px(SPACE_XXL).py(SPACE_XXL).rounded(theme.radius_lg)@@ -8346,7 +8456,14 @@ fn empty_state(.text_color(theme.foreground).child(title.into()),)- .child(div().text_size(FONT_CAPTION).child(caption.into()))+ // 占满卡片宽、居中换行:放大档位下卡片比一行说明窄时折行,而不是撑出栏外+ .child(+ div()+ .w_full()+ .text_center()+ .text_size(FONT_CAPTION)+ .child(caption.into()),+ )}fn image_format_of(media_type: &str) -> Option<gpui::ImageFormat> {@@ -8516,19 +8633,22 @@ fn export_dir(store: &Store) -> PathBuf {}fn zoom_fit(dims: Option<(u32, u32)>, viewport: Size<Pixels>) -> Size<Pixels> {- let available_width = (f32::from(viewport.width) - 112.0).max(120.0);- let available_height = (f32::from(viewport.height) - 164.0).max(120.0);+ // 在 100% 档的坐标里算(边距与上限都是设计稿值),最后只乘一次缩放倍数——+ // 拿实际窗口像素算完再过 zpx 会乘两次,放大档位下大图撑出窗口+ let factor = ui_zoom::factor();+ let available_width = (f32::from(viewport.width) / factor - 112.0).max(120.0);+ let available_height = (f32::from(viewport.height) / factor - 164.0).max(120.0);let Some((width, height)) = dims.filter(|(width, height)| *width > 0 && *height > 0) else {return gpui::size(- px(available_width.min(720.0)),- px(available_height.min(480.0)),+ zpx(available_width.min(720.0)),+ zpx(available_height.min(480.0)),);};let (width, height) = (width as f32, height as f32);let scale = (available_width / width).min(available_height / height).min(1.0);- gpui::size(px(width * scale), px(height * scale))+ gpui::size(zpx(width * scale), zpx(height * scale))}fn zoom_shadow(y: Pixels, blur: Pixels, alpha: f32) -> gpui::BoxShadow {@@ -8559,7 +8679,7 @@ fn message_content(text: &str,session: &SessionMeta,slots: &[ImageSlot],- base: Pixels,+ base: impl Into<Pixels>,paragraph_gap: gpui::Rems,dark: bool,border: Hsla,@@ -8568,6 +8688,7 @@ fn message_content(workbench: Entity<Workbench>,cx: &mut App,) -> Vec<AnyElement> {+ let base: Pixels = base.into();let mut content = Vec::new();let mut cursor = 0usize;let mut image_index = 0usize;@@ -8719,7 +8840,7 @@ fn image_strip(}).child(t("Preview unavailable")).child(div().max_w_full().truncate().child(media_type.clone()))- .child(icon("icons/download.svg").with_size(px(14.)))+ .child(icon("icons/download.svg").with_size(zpx(14.))).into_any_element()}ImageSlot::Omitted { .. } => v_flex()@@ -8750,13 +8871,13 @@ fn centered_pill(text: impl Into<SharedString>, cx: &App) -> Div {let theme = cx.theme();div().w_full().flex().justify_center().child(div()- .px(px(10.))- .py(px(3.))+ .px(zpx(10.))+ .py(zpx(3.)).rounded_full().bg(theme.muted).text_size(FONT_LABEL).text_color(theme.muted_foreground)- .max_w(px(520.))+ .max_w(zpx(520.)).truncate().child(text.into()),)@@ -8771,7 +8892,7 @@ fn markdown_body(text: impl Into<SharedString>,host: &str,project_path: &str,- base: Pixels,+ base: impl Into<Pixels>,paragraph_gap: gpui::Rems,dark: bool,cx: &mut App,@@ -8787,7 +8908,7 @@ fn markdown_body(let view = TextView::markdown(themed_id, text).style(TextViewStyle {- heading_base_font_size: base,+ heading_base_font_size: base.into(),paragraph_gap,is_dark: dark,highlight_theme: if dark {@@ -8820,14 +8941,14 @@ fn markdown_body(h_flex().items_center().gap(SPACE_SM)- .px(px(6.))+ .px(zpx(6.)).text_size(FONT_LABEL).text_color(theme.muted_foreground).when_some(block.lang(), |actions, lang| actions.child(lang)).child(div().id("code-copy")- .size(px(20.))+ .size(zpx(20.)).flex().items_center().justify_center()@@ -8840,7 +8961,7 @@ fn markdown_body(.on_click(move |_, _, cx| {cx.write_to_clipboard(ClipboardItem::new_string(code.to_string()));})- .child(icon("icons/copy.svg").with_size(px(12.))),+ .child(icon("icons/copy.svg").with_size(zpx(12.))),)}).selectable(true);@@ -8879,7 +9000,7 @@ fn thinking_panel(.hover(|style| style.text_colored(theme.foreground, FONT_MSG_THINKING)).child(icon("icons/chevron-right.svg")- .with_size(px(11.))+ .with_size(zpx(11.)).flex_shrink_0().when(expanded, |icon| {icon.rotate(gpui::Radians(std::f32::consts::FRAC_PI_2))@@ -8904,7 +9025,7 @@ fn thinking_panel(div().w_full().min_w_0()- .pl(px(30.))+ .pl(zpx(30.)).pr(SPACE_MD).pb(SPACE_MD).whitespace_normal()@@ -8994,7 +9115,7 @@ fn tool_cluster(.hover(|style| style.text_colored(theme.foreground, FONT_MSG_THINKING)).child(icon("icons/chevron-right.svg")- .with_size(px(11.))+ .with_size(zpx(11.)).flex_shrink_0().when(expanded, |icon| {icon.rotate(gpui::Radians(std::f32::consts::FRAC_PI_2))@@ -9022,7 +9143,7 @@ fn tool_cluster(header.child(div().flex_shrink_0()- .px(px(7.))+ .px(zpx(7.)).rounded(RADIUS_BADGE).text_size(FONT_LABEL).text_color(theme.danger)@@ -9044,8 +9165,8 @@ fn tool_cluster(.w_full().min_w_0().px(SPACE_MD)- .py(px(10.))- .gap(px(6.))+ .py(zpx(10.))+ .gap(zpx(6.)).when(call_ix > 0, |item| {item.border_t_1().border_color(panel_border)});@@ -9055,7 +9176,7 @@ fn tool_cluster(h_flex().w_full().min_w_0()- .gap(px(7.))+ .gap(zpx(7.)).child(div().flex_shrink_0()@@ -9165,7 +9286,7 @@ fn tool_section(.child(div().id(copy_id)- .size(px(20.))+ .size(zpx(20.)).flex().items_center().justify_center()@@ -9180,15 +9301,15 @@ fn tool_section(.on_click(move |_, _, cx| {cx.write_to_clipboard(ClipboardItem::new_string(full.clone()));})- .child(icon("icons/copy.svg").with_size(px(12.))),+ .child(icon("icons/copy.svg").with_size(zpx(12.))),),).child(div().w_full().min_w_0()- .px(px(10.))- .py(px(7.))+ .px(zpx(10.))+ .py(zpx(7.)).rounded(RADIUS_KBD).bg(if is_error {theme.danger.opacity(0.08)@@ -9248,7 +9369,7 @@ fn host_badge(host: &str, theme: &gpui_component::Theme) -> impl IntoElement {fn badge(name: impl Into<SharedString>, bg: Hsla, fg: Hsla) -> impl IntoElement {div().min_w_0()- .px(px(6.))+ .px(zpx(6.)).py(px(1.)).rounded(RADIUS_BADGE).bg(bg)@@ -9261,7 +9382,7 @@ fn badge(name: impl Into<SharedString>, bg: Hsla, fg: Hsla) -> impl IntoElementfn outline_badge(name: impl Into<SharedString>, color: Hsla) -> impl IntoElement {div().min_w_0()- .px(px(6.))+ .px(zpx(6.)).py(px(1.)).rounded(RADIUS_BADGE).border_1()@@ -9275,7 +9396,7 @@ fn outline_badge(name: impl Into<SharedString>, color: Hsla) -> impl IntoElement/// muted 的标签 + 右侧低对比度 hairline,32px 高、px 12fn section_header_row(label: impl Into<SharedString>, theme: &gpui_component::Theme) -> Div {h_flex()- .h(px(32.))+ .h(zpx(32.)).w_full().items_center().gap(SPACE_SM)@@ -9297,12 +9418,14 @@ fn project_badge(theme: &gpui_component::Theme,) -> AnyElement {let badge = badge(label, theme.muted, theme.muted_foreground);+ // 包装层也要能收缩,徽章自己的省略号才轮得到出场(头部右侧按钮多、栏窄时)if path.is_empty() {- return div().child(badge).into_any_element();+ return div().min_w_0().child(badge).into_any_element();}let path = path.to_string();div().id(id)+ .min_w_0().cursor_pointer().tooltip(|window, cx| gpui_component::tooltip::Tooltip::new(show_in_fm()).build(window, cx)).on_click(move |_, _, _| terminal::open_in_file_manager(&path))@@ -9341,6 +9464,8 @@ fn detail_header_frame(h_flex().flex_1().min_w_0()+ // 放不下时裁掉,别画到右侧按钮底下(放大档位下窄栏常见)+ .overflow_hidden().gap(ICON_TEXT_GAP).items_center().text_size(FONT_LABEL)@@ -9386,10 +9511,17 @@ fn detail_header_frame(}/// 底部工具条按钮的边长:比导航行(32)小一档-const FOOTER_BTN: Pixels = px(28.);+const FOOTER_BTN: Zpx = Zpx(28.);++/// 底部工具条的最小宽度:左内边距 + 四颗(三页 + 清理)+ Settings + 按钮间距 + 两组之间+/// 至少一个 SPACE_SM + 右内边距。100% 档约 177,侧栏 224 绰绰有余;放大后侧栏收窄时+/// 以它为下限(`Workbench::columns`)+fn sidebar_footer_width() -> Pixels {+ FOOTER_LEAD_INSET + FOOTER_BTN * 5. + zpx(2.) * 3. + SPACE_SM + SIDEBAR_EDGE+}/// 工具条左内边距 = 26.75(侧栏中轴,红绿灯红灯中心)− 14(按钮半宽):最左那颗/// 图标的中心压在与导航行行首同一条轴上(用户 2026-09-21)-const FOOTER_LEAD_INSET: Pixels = px(12.75);+const FOOTER_LEAD_INSET: Zpx = Zpx(LEAD_AXIS.0 - FOOTER_BTN.0 / 2.);/// 底部工具条的图标按钮(Zed 状态栏 / Xcode 导航条同款图标条,不带盒子):透明底、/// hover 才出色;`active`(当前页 / 清理模式)用侧栏行的选中色做圆角底 + 选中前景,@@ -9423,7 +9555,7 @@ fn sidebar_tool_btn(}).tooltip(move |window, cx| gpui_component::tooltip::Tooltip::new(tooltip).build(window, cx)).on_click(on_click)- .child(icon(glyph).with_size(px(14.)))+ .child(icon(glyph).with_size(zpx(14.)))}/// Things 风源列表行:图标 + 文字 + 计数,6px 圆角选中胶囊@@ -9449,7 +9581,7 @@ fn sidebar_row(.pl(if sub {LEAD_INSET + SUB_INDENT} else {- LEAD_INSET+ LEAD_INSET.get()}).pr(SIDEBAR_EDGE).rounded(theme.radius)@@ -9482,7 +9614,7 @@ fn sidebar_row(.child(match lead {// 线条图标比实心品牌图视觉轻,给它小一档才平衡RowLead::Icon(ic) => ic- .with_size(if sub { px(14.) } else { NAV_ICON })+ .with_size(if sub { zpx(14.) } else { NAV_ICON.get() }).text_color(if active {theme.sidebar_accent_foreground} else {@@ -9541,8 +9673,8 @@ fn open_in_icon(fallback: Icon,) -> AnyElement {match (term.and_then(|t| t.brand_icon()), icon_path) {- (Some(b), _) => img(b).size(px(16.)).into_any_element(),- (None, Some(p)) => img(p.clone()).size(px(16.)).into_any_element(),+ (Some(b), _) => img(b).size(zpx(16.)).into_any_element(),+ (None, Some(p)) => img(p.clone()).size(zpx(16.)).into_any_element(),(None, None) => fallback.into_any_element(),}}@@ -9560,10 +9692,10 @@ fn tool_btn() -> Button {let ic = if highlighted {icon(filled_icon_path)- .with_size(px(16.))+ .with_size(zpx(16.)).text_color(active_color)} else {- icon(icon_path).with_size(px(16.))+ icon(icon_path).with_size(zpx(16.))};Button::new(id).ghost()@@ -9582,6 +9714,8 @@ impl Focusable for Workbench {impl Render for Workbench {fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {self.sync_language(window, cx);+ self.sync_zoom(window);+ self.viewport_width = window.viewport_size().width;self.refresh_session_group_date(cx);self.restore_pending_list_selection(window, cx);let theme = cx.theme();diff --git a/crates/wake/src/workbench/cleanup.rs b/crates/wake/src/workbench/cleanup.rsindex 1c11a64..0331f18 100644--- a/crates/wake/src/workbench/cleanup.rs+++ b/crates/wake/src/workbench/cleanup.rs@@ -74,8 +74,8 @@ impl Default for CleanupState {}}}-const CLEANUP_DATE_WIDTH: Pixels = px(112.);-const CLEANUP_SIZE_WIDTH: Pixels = px(88.);+const CLEANUP_DATE_WIDTH: Zpx = Zpx(112.);+const CLEANUP_SIZE_WIDTH: Zpx = Zpx(88.);fn bytes(n: u64) -> String {if n == 0 {@@ -274,7 +274,7 @@ fn cleanup_review_item(.min_w_0().child(img(item.root.agent.brand_icon(theme.mode.is_dark()))- .size(px(16.))+ .size(zpx(16.)).flex_shrink_0(),).child(div().flex_1().min_w_0().child(cleanup_title(@@ -309,7 +309,7 @@ fn cleanup_review_item(.child(Button::new(SharedString::from(format!("review-files-{key}"))).ghost()- .h(px(28.))+ .h(zpx(28.)).px(SPACE_SM).text_size(FONT_CAPTION).rounded(RADIUS_BUTTON)@@ -319,7 +319,7 @@ fn cleanup_review_item(} else {"icons/chevron-right.svg"})- .with_size(px(12.)),+ .with_size(zpx(12.)),).label(crate::tf!("Source files ({})", files.len())).on_click(move |_, window, _| {@@ -353,7 +353,7 @@ fn cleanup_review_item(v_flex().flex_1().min_w_0()- .gap(px(2.))+ .gap(zpx(2.)).child(cleanup_path(path,SharedString::from(format!(@@ -430,14 +430,14 @@ fn cleanup_session_title(.when(pinned, |v| {v.child(icon("icons/pin-filled.svg")- .with_size(px(11.))+ .with_size(zpx(11.)).text_color(cx.theme().primary),)}).when(starred, |v| {v.child(icon("icons/star-filled.svg")- .with_size(px(11.))+ .with_size(zpx(11.)).text_color(rgb(crate::theme::STAR_YELLOW)),)})@@ -684,14 +684,15 @@ impl Workbench {fn confirm_cleanup(&self, review: CleanupReview, window: &mut Window, cx: &mut Context<Self>) {if review.ready.is_empty() {let entity = cx.entity();- open_closable_dialog(window, cx, move |dialog, window, cx| {+ open_closable_dialog(window, cx, 640., move |dialog, window, cx| {let entity = entity.clone();- dialog.title(t("Unable to clean up these sessions")).width(px(640.))+ dialog.title(t("Unable to clean up these sessions")).child(v_flex().gap(SPACE_MD).child(div().text_size(FONT_CAPTION).text_color(cx.theme().muted_foreground).child(t("The selected sessions could not be verified. No files were moved.")))+ // 预留量按 100% 档估的,放大后可能比窗口还高:下限保证列表看得见几行.child(v_flex().id("cleanup-blocked-list")- .max_h((window.viewport_size().height - px(380.)).min(px(360.)))+ .max_h((window.viewport_size().height - zpx(380.)).clamp(zpx(96.), zpx(360.))).overflow_y_scroll().child(cleanup_review_issues(&review.skipped, cx))).child(h_flex().justify_end().child(@@ -709,7 +710,7 @@ impl Workbench {let skipped = Rc::new(review.skipped);let expanded = Rc::new(std::cell::RefCell::new(HashSet::new()));let entity = cx.entity();- window.open_alert_dialog(cx, move |dialog, window, cx| {+ open_alert(window, cx, 640., move |dialog, window, cx| {let items = chosen.clone();let entity = entity.clone();let theme = cx.theme();@@ -721,7 +722,6 @@ impl Workbench {};dialog.title(div().text_size(FONT_HEADING).font_semibold().child(title))- .width(px(640.)).confirm().button_props(gpui_component::dialog::DialogButtonProps::default()@@ -804,7 +804,11 @@ impl Workbench {.child(v_flex().id("cleanup-review-files")- .max_h((window.viewport_size().height - px(420.)).min(px(300.)))+ // 同上:放大档位下给列表留一个正的下限+ .max_h(+ (window.viewport_size().height - zpx(420.))+ .clamp(zpx(96.), zpx(300.)),+ ).overflow_y_scroll().when(!skipped.is_empty(), |v| {v.child(div().font_medium().child(t("To delete")))@@ -1041,7 +1045,7 @@ impl Workbench {.ghost().disabled(state.busy).rounded(RADIUS_BUTTON)- .icon(icon("icons/arrow-up-down.svg").with_size(px(16.)))+ .icon(icon("icons/arrow-up-down.svg").with_size(zpx(16.))).tooltip(crate::tf!("Sort by {} · {}",sort_label(current),@@ -1084,7 +1088,7 @@ impl Workbench {}),);}- menu.min_w(px(180.))+ menu.min_w(zpx(180.))}).anchor(Anchor::TopRight);let chosen = self.cleanup_chosen();@@ -1183,7 +1187,7 @@ impl Workbench {Button::new("cleanup-refresh").ghost().rounded(RADIUS_BUTTON)- .icon(icon("icons/refresh-cw.svg").with_size(px(16.)))+ .icon(icon("icons/refresh-cw.svg").with_size(zpx(16.))).tooltip(t("Refresh")).disabled(state.loading || state.busy).on_click(@@ -1200,7 +1204,7 @@ impl Workbench {.min_h_0().child(h_flex()- .h(px(44.))+ .h(zpx(44.)).flex_shrink_0().px(SPACE_XXL).gap(SPACE_MD)@@ -1303,8 +1307,8 @@ impl Workbench {v.child(v_flex().flex_1().items_center().justify_center().child(empty_state_card("icons/inbox.svg",- px(58.),- px(24.),+ zpx(58.),+ zpx(24.),t("No sessions match these filters"),t("Try a different agent, project, or filter."),cx,diff --git a/crates/wake/src/workbench/cleanup/filter.rs b/crates/wake/src/workbench/cleanup/filter.rsindex cc111c4..1c6e343 100644--- a/crates/wake/src/workbench/cleanup/filter.rs+++ b/crates/wake/src/workbench/cleanup/filter.rs@@ -3,9 +3,12 @@ use super::*;use gpui_component::Selectable as _;use std::collections::BTreeSet;-const FILTER_WIDTH: Pixels = px(468.);-const SOURCE_WIDTH: Pixels = px(232.);-const AGENT_WIDTH: Pixels = px(153.);+const FILTER_WIDTH: Zpx = Zpx(468.);+/// 浮层上下要让出的高度:触发钮在页头里的下沿(约 64)+ 浮层自己上下的内边距 + 底部留白。+/// 放大档位下内容会比窗口高,超出的部分在中间那段里滚,标题与 Clear / Done 始终看得见+const FILTER_CHROME: Zpx = Zpx(112.);+const SOURCE_WIDTH: Zpx = Zpx(232.);+const AGENT_WIDTH: Zpx = Zpx(153.);fn source_choices(inventory: &CleanupInventory,@@ -62,7 +65,7 @@ fn choice_button(id: impl Into<ElementId>, selected: bool, cx: &App) -> Button {let theme = cx.theme();Button::new(id).small()- .h(px(28.))+ .h(zpx(28.)).px(SPACE_SM).rounded(RADIUS_BUTTON).custom(@@ -146,16 +149,16 @@ fn multi_choice(fn option_label(button: Button, label: &str, selected: bool, cx: &App) -> Button {button.relative()- .pr(px(20.))+ .pr(zpx(20.)).label(clip_display(label, 24)).tooltip(label.to_owned()).child(div().flex_1()).child(icon("icons/check.svg")- .with_size(px(10.))+ .with_size(zpx(10.)).absolute()- .right(SPACE_XS - px(20.))- .top(px(9.))+ .right(SPACE_XS - zpx(20.))+ .top(zpx(9.)).text_color(if selected {cx.theme().primary} else {@@ -172,7 +175,7 @@ fn agent_label(cx: &App,) -> Button {// 行首 6px 处放 15px 品牌图,文字从 6 + 15 + ICON_TEXT_GAP 起(与别处图标-文字同距)- let text_start = px(6.) + px(15.) + ICON_TEXT_GAP;+ let text_start = zpx(6.) + zpx(15.) + ICON_TEXT_GAP;option_label(button, label, selected, cx).pl(text_start).child(@@ -180,9 +183,9 @@ fn agent_label(// to the reserved leading slot without shifting text on selection.div().absolute()- .left(px(6.) - text_start)- .top(px(6.5))- .size(px(15.))+ .left(zpx(6.) - text_start)+ .top(zpx(6.5))+ .size(zpx(15.)).child(leading),)}@@ -249,7 +252,7 @@ impl Workbench {.child(h_flex().w_full()- .p(px(2.))+ .p(zpx(2.)).rounded(theme.radius).bg(theme.secondary).children(@@ -325,7 +328,7 @@ impl Workbench {).w(AGENT_WIDTH),label,- img(agent.brand_icon(theme.mode.is_dark())).size(px(15.)),+ img(agent.brand_icon(theme.mode.is_dark())).size(zpx(15.)),selected,cx,));@@ -369,7 +372,7 @@ impl Workbench {v_flex().id("cleanup-filter-sources").w_full()- .max_h((window.viewport_size().height - px(542.)).clamp(px(100.), px(264.)))+ .max_h((window.viewport_size().height - zpx(542.)).clamp(zpx(100.), zpx(264.))).overflow_y_scroll().track_scroll(&this.cleanup.filter_scroll).gap(SPACE_LG)@@ -384,11 +387,11 @@ impl Workbench {v.child(v_flex().w_full()- .min_h(px(80.))+ .min_h(zpx(80.)).items_center().justify_center().gap(SPACE_SM)- .child(icon("icons/search.svg").with_size(px(20.)))+ .child(icon("icons/search.svg").with_size(zpx(20.))).child(div().text_size(FONT_CAPTION)@@ -416,7 +419,7 @@ impl Workbench {.on_click(move |_, window, cx| {focus_input.update(cx, |input, cx| input.focus(window, cx));})- .child(icon("icons/search.svg").with_size(px(13.)).flex_shrink_0())+ .child(icon("icons/search.svg").with_size(zpx(13.)).flex_shrink_0()).child(Input::new(input).appearance(false)@@ -430,10 +433,10 @@ impl Workbench {Button::new("cleanup-clear-source-search").ghost().small()- .size(px(24.))+ .size(zpx(24.)).p_0().rounded(RADIUS_BUTTON)- .icon(icon("icons/circle-x.svg").with_size(px(14.)))+ .icon(icon("icons/circle-x.svg").with_size(zpx(14.))).tooltip(t("Clear search")).on_click(move |_, window, cx| {clear_input.update(cx, |input, cx| {@@ -465,7 +468,7 @@ impl Workbench {.rounded(RADIUS_BUTTON).icon(icon("icons/sliders-horizontal.svg")- .with_size(px(16.))+ .with_size(zpx(16.)).text_color(if has_filters(&self.cleanup.options) {theme.primary} else {@@ -484,17 +487,12 @@ impl Workbench {let options = &this.cleanup.options;let popover = cx.entity();let clear_entity = entity.clone();- v_flex()- .w(FILTER_WIDTH)+ let body = v_flex()+ .id("cleanup-filter-body")+ .flex_1()+ .min_h_0()+ .overflow_y_scroll().gap(SPACE_LG)- .child(- h_flex().h(px(28.)).items_center().child(- div()- .text_size(FONT_HEADING)- .font_semibold()- .child(t("Filter")),- ),- ).child(v_flex().gap(SPACE_MD)@@ -570,16 +568,30 @@ impl Workbench {).when_some(this.cleanup.filter_input.as_ref(), |row, input| {row.child(- div().w(px(284.)).child(Self::cleanup_source_search(+ div().w(zpx(284.)).child(Self::cleanup_source_search(&entity, input, cx,)),)}),).child(Self::cleanup_filter_sources(&entity, window, cx)),+ );+ v_flex()+ .w(FILTER_WIDTH)+ .max_h(window.viewport_size().height - FILTER_CHROME)+ .gap(SPACE_LG)+ .child(+ h_flex().h(zpx(28.)).flex_shrink_0().items_center().child(+ div()+ .text_size(FONT_HEADING)+ .font_semibold()+ .child(t("Filter")),+ ),)+ .child(body).child(h_flex()+ .flex_shrink_0().gap(SPACE_MD).items_center().justify_between()@@ -627,7 +639,7 @@ impl Workbench {cx,).map(action_button)- .min_w(px(80.))+ .min_w(zpx(80.)).bg(cx.theme().primary).on_click(move |_, window, cx| {popover.update(cx, |state, cx| state.dismiss(window, cx))diff --git a/crates/wake/src/workbench/cleanup/history.rs b/crates/wake/src/workbench/cleanup/history.rsindex a21eeeb..2a584d2 100644--- a/crates/wake/src/workbench/cleanup/history.rs+++ b/crates/wake/src/workbench/cleanup/history.rs@@ -134,14 +134,14 @@ fn batch_sessions(batch: &CleanupBatch) -> usize {.sum()}-const HISTORY_ROW_HEIGHT: Pixels = px(88.);+const HISTORY_ROW_HEIGHT: Zpx = Zpx(88.);fn history_status(status: Outcome, cx: &App) -> impl IntoElement {let color = status.color(cx);div().flex_shrink_0().px(SPACE_SM)- .py(px(3.))+ .py(zpx(3.)).rounded(RADIUS_BUTTON).bg(color.opacity(0.08)).text_size(FONT_LABEL)@@ -177,14 +177,14 @@ impl Workbench {.items_start().window_control_area(WindowControlArea::Drag).child(- div().pt(px(24.)).child(+ div().pt(zpx(24.)).child(Button::new("cleanup-history-back").ghost().map(action_button).with_size(gpui_component::Size::Medium)- .w(px(32.))+ .w(zpx(32.)).px_0()- .icon(icon("icons/chevron-left.svg").with_size(px(16.)))+ .icon(icon("icons/chevron-left.svg").with_size(zpx(16.))).tooltip(parent).disabled(self.cleanup.busy).on_click(cx.listener(|this, _, window, cx| {@@ -236,8 +236,8 @@ impl Workbench {let count = self.cleanup.history.len();let available_height =(window.viewport_size().height - LIBRARY_IDENTITY_HEIGHT - SPACE_SM - SPACE_XXL)- .max(HISTORY_ROW_HEIGHT);- let panel_height = (HISTORY_ROW_HEIGHT * count as f32 + px(2.)).min(available_height);+ .max(HISTORY_ROW_HEIGHT.get());+ let panel_height = (HISTORY_ROW_HEIGHT * count as f32 + zpx(2.)).min(available_height);v_flex().flex_1().min_h_0()@@ -250,8 +250,8 @@ impl Workbench {view.child(div().flex_1().flex().items_center().justify_center().child(empty_state_card("icons/brush-cleaning.svg",- px(58.),- px(26.),+ zpx(58.),+ zpx(26.),t("No cleanup history yet"),t("Your cleanup results will appear here."),cx,@@ -358,14 +358,14 @@ impl Workbench {.flex().items_center().justify_center()- .size(px(36.))+ .size(zpx(36.)).flex_shrink_0().rounded(theme.radius).bg(theme.background).when_some(first, |view, record| {view.child(img(record.candidate.root.agent.brand_icon(theme.mode.is_dark()))- .size(px(22.)),+ .size(zpx(22.)),)}),)@@ -373,7 +373,7 @@ impl Workbench {v_flex().flex_1().min_w_0()- .gap(px(6.))+ .gap(zpx(6.)).child(div().id(("cleanup-history-title", ix))@@ -402,7 +402,7 @@ impl Workbench {v_flex().flex_shrink_0().items_end()- .gap(px(6.))+ .gap(zpx(6.)).child(div().text_size(FONT_HEADING)@@ -413,7 +413,7 @@ impl Workbench {).child(icon("icons/chevron-right.svg")- .with_size(px(14.))+ .with_size(zpx(14.)).text_color(theme.muted_foreground).flex_shrink_0(),)@@ -447,7 +447,7 @@ impl Workbench {.w_full().max_w(READER_MAX_WIDTH).pt(SPACE_SM)- .pb(px(40.))+ .pb(zpx(40.)).gap(SPACE_XXL).child(v_flex()@@ -466,13 +466,13 @@ impl Workbench {.flex().items_center().justify_center()- .size(px(36.))+ .size(zpx(36.)).flex_shrink_0().rounded(theme.radius).bg(status.color(cx).opacity(0.08)).child(icon(status.icon())- .with_size(px(18.))+ .with_size(zpx(18.)).text_color(status.color(cx)),),)@@ -480,7 +480,7 @@ impl Workbench {v_flex().flex_1().min_w_0()- .gap(px(6.))+ .gap(zpx(6.)).child(div().text_size(FONT_HEADING)@@ -498,7 +498,7 @@ impl Workbench {v_flex().flex_shrink_0().items_end()- .gap(px(4.))+ .gap(zpx(4.)).child(div().text_size(FONT_TITLE)@@ -650,14 +650,14 @@ impl Workbench {.items_center().child(img(candidate.root.agent.brand_icon(theme.mode.is_dark()))- .size(px(24.))+ .size(zpx(24.)).flex_shrink_0(),).child(v_flex().flex_1().min_w_0()- .gap(px(6.))+ .gap(zpx(6.)).child(cleanup_title(candidate, ("history-session-title", ix), cx)).child(div()@@ -697,7 +697,7 @@ impl Workbench {.id(("cleanup-result-files", ix)).role(accesskit::Role::Button).aria_label(format!("{} · {}", candidate.root.title, file_label))- .h(px(40.))+ .h(zpx(40.)).px(SPACE_LG).gap(ICON_TEXT_GAP).border_t_1()@@ -724,7 +724,7 @@ impl Workbench {cx.stop_propagation();}}))- .child(icon("icons/folder.svg").with_size(px(14.)))+ .child(icon("icons/folder.svg").with_size(zpx(14.))).child(div().flex_1().child(file_label)).child(icon(if expanded {@@ -732,7 +732,7 @@ impl Workbench {} else {"icons/chevron-right.svg"})- .with_size(px(14.)),+ .with_size(zpx(14.)),),).when(expanded, |view| {diff --git a/crates/wake/src/workbench/cleanup/rows.rs b/crates/wake/src/workbench/cleanup/rows.rsindex 1504499..c805e57 100644--- a/crates/wake/src/workbench/cleanup/rows.rs+++ b/crates/wake/src/workbench/cleanup/rows.rs@@ -78,11 +78,11 @@ impl Workbench {div().w_full().px(SPACE_LG)- .py(px(2.))+ .py(zpx(2.)).child(list_row_shell(SharedString::from(format!("cleanup-{key}")),- px(60.),+ zpx(60.),selected,theme,)@@ -153,14 +153,14 @@ impl Workbench {.text_color(theme.muted_foreground).child(img(meta.agent.brand_icon(theme.mode.is_dark()))- .size(px(15.))+ .size(zpx(15.)).flex_shrink_0(),).child(div().id(("cleanup-source", ix)).min_w_0()- .max_w(px(128.))+ .max_w(zpx(128.)).child(badge(meta.project_name.clone(),theme.muted,diff --git a/crates/wake/src/workbench/memory.rs b/crates/wake/src/workbench/memory.rsindex d2c3470..ec624fd 100644--- a/crates/wake/src/workbench/memory.rs+++ b/crates/wake/src/workbench/memory.rs@@ -66,12 +66,19 @@ pub(super) struct MemoryState {sync_pending: bool,}+impl MemoryState {+ /// 换过缩放档位:行高按旧倍数量过,按比例重量(见 Workbench::sync_zoom)+ pub(super) fn remeasure(&self) {+ self.list.remeasure();+ }+}+impl Default for MemoryState {fn default() -> Self {Self {docs: Vec::new(),rows: Vec::new(),- list: gpui::ListState::new(0, gpui::ListAlignment::Top, px(200.)),+ list: gpui::ListState::new(0, gpui::ListAlignment::Top, zpx(200.)),loading: false,selected: None,loaded: None,@@ -358,8 +365,8 @@ impl Workbench {} else {empty_state_card("icons/file-text.svg",- px(58.),- px(24.),+ zpx(58.),+ zpx(24.),t("No memory files yet"),t("Agents write these as they work: Claude Code's auto-memory, Codex's memories, ZCode's project memory. They show up here once they exist."),cx,@@ -374,7 +381,7 @@ impl Workbench {.h_full().child(v_flex()- .w(SESSION_STREAM_WIDTH)+ .w(self.columns().1).h_full().flex_shrink_0().bg(theme.colors.list)@@ -512,7 +519,7 @@ impl Workbench {.text_color(theme.muted_foreground).child(img(d.agent.brand_icon(theme.mode.is_dark()))- .size(px(15.))+ .size(zpx(15.)).flex_shrink_0(),)// 项目徽章与会话行同款(muted 胶囊;用户级 / 没归属的@@ -575,7 +582,7 @@ impl Workbench {crate::tf!("Updated {}", abs_date(doc.updated_at)).into();let mut lead: Vec<AnyElement> = vec![img(doc.agent.brand_icon(dark))- .size(px(15.))+ .size(zpx(15.)).flex_shrink_0().into_any_element(),div()@@ -594,7 +601,7 @@ impl Workbench {Button::new("memory-reveal").ghost().rounded(RADIUS_BUTTON)- .icon(icon("icons/folder.svg").with_size(px(16.)))+ .icon(icon("icons/folder.svg").with_size(zpx(16.))).tooltip(reveal_in_fm()).on_click(move |_, _, _| {terminal::reveal_in_file_manager(&reveal_path);@@ -603,7 +610,7 @@ impl Workbench {Button::new("memory-copy-path").ghost().rounded(RADIUS_BUTTON)- .icon(icon("icons/copy.svg").with_size(px(16.)))+ .icon(icon("icons/copy.svg").with_size(zpx(16.))).tooltip(t("Copy path")).on_click(move |_, _, cx| {cx.write_to_clipboard(ClipboardItem::new_string(copy_path.clone()));@@ -616,7 +623,7 @@ impl Workbench {.gap(ICON_TEXT_GAP).child(icon("icons/file-text.svg")- .with_size(px(12.))+ .with_size(zpx(12.)).flex_shrink_0(),).child(div().min_w_0().truncate().child(tilde_path(&source_path)))@@ -627,7 +634,7 @@ impl Workbench {.items_center().child(icon("icons/calendar.svg")- .with_size(px(12.))+ .with_size(zpx(12.)).flex_shrink_0(),).child(