From ab2e39200bc34d2365e9032d50238636ff50aa32 Mon Sep 17 00:00:00 2001 From: GeekMr <140129782+WilliamWang1721@users.noreply.github.com> Date: Sun, 27 Sep 2026 10:20:33 +0800 Subject: [PATCH 1/5] fix(gpui): open the startup window at config.window.dimensions The default shell had no reader for `config.window.*`, so `pebrel config check` accepted a window size the GUI then ignored: every start used the built-in 116x30 canvas regardless of the user's file. Read the grid once during shell init through the same discovery and parse entry points `pebrel config check` uses, so Lua, TOML and YAML all work and precedence matches the rest of the app. It stays a grid rather than pixels: the existing sizing path multiplies it by the cell it measures in the window's own scale domain, which keeps 155x43 correct at 125% scaling. `config.window.position` is deliberately not wired here. gpui accepts placement only at window creation, in logical pixels, and exposes no app-level scale factor, while the legacy shell hands winit a physical position; passing the raw numbers through would place the window a fifth of the screen off at exactly the scaling the report uses. Refs #312 --- .../2026-09-27-config-window-startup-size.md | 128 ++++++++++++++++++ nebula_app/src/gpui_shell/config.rs | 108 ++++++++++++++- nebula_app/src/gpui_shell/mod.rs | 1 + nebula_app/src/gpui_shell/workspace.rs | 23 ++-- 4 files changed, 246 insertions(+), 14 deletions(-) create mode 100644 architecture/notes/nebula_app/gpui_shell/2026-09-27-config-window-startup-size.md diff --git a/architecture/notes/nebula_app/gpui_shell/2026-09-27-config-window-startup-size.md b/architecture/notes/nebula_app/gpui_shell/2026-09-27-config-window-startup-size.md new file mode 100644 index 000000000..801c9eb51 --- /dev/null +++ b/architecture/notes/nebula_app/gpui_shell/2026-09-27-config-window-startup-size.md @@ -0,0 +1,128 @@ +# Startup window size follows `config.window.dimensions` + +## Status + +Implemented for issue #312 (GPUI shell, `dimensions` only). + +## Context + +The GPUI shell is the default product shell (`default = ["gpui-shell"]`, and +the legacy shell is a separate compile-time feature, so `config::load` is not +even in the shipped binary). Its only touch with the user's config file was +`gpui_shell::config::find_config_file()`, which resolves +`config::source::discover_toml()` and merges imports with its own TOML reader — +TOML only, never Lua, and only for the keys the settings page wants. So +`config.window.*` had no reader in the shell at all, while `pebrel config +check` — which uses `config::source::discover` + `config::load_source` — +accepted and validated keys the running app ignored. The reporter's +`config.window.dimensions = { columns = 155, lines = 43 }` on Windows 11 at +125% scaling fell into that gap: the window always opened at the shell's fixed +startup geometry. + +Startup size had a second, independent cause. `workspace_window_options` pins a +1080×720 logical centered window with a 760×540 minimum, and the real grid came +from `prepare_initial_grid`, which multiplied the hard-coded +`TerminalView::DEFAULT_GRID_COLUMNS`/`DEFAULT_GRID_LINES` (116×30) by the +measured startup cell size. The 116×30 pair was itself the legacy shell's +default canvas, not a user value. + +## Evidence + +- `config::source::discover` / `config::load_source` are the same entry points + `config_cli.rs` uses for `pebrel config check`, so a key accepted there must + mean the same thing here. +- `WindowConfig::dimensions()` already carries the legacy contract "both + nonzero, else unset"; `display::window_size` clamps each axis to + `term::MIN_COLUMNS` / `term::MIN_SCREEN_LINES`. +- gpui rev `7c66238`: `WindowOptions::window_bounds` and `Window::resize` take + logical `Pixels` (scaled per window by the platform layer), `App` exposes no + scale factor, and `Window` has no `set_position`/`move_window`. +- Local `cargo check -p nebula` cannot complete on this machine: the + `gpui_macos` build script needs the Xcode `metal` tool + (`xcrun: error: unable to find utility "metal"`), so compile-level + verification runs in CI. See Validation. + +## Decision + +`gpui_shell::config::StartupWindow` holds the startup grid and is loaded once in +`init()` through `config::source::discover(None)` + `config::load_source` — the +pair `pebrel config check` uses, so a key accepted there means the same thing +here, and Lua, TOML and YAML share one path. `config::load` was not used: it +takes `&mut Options`, and the shell's `init(cx: &App)` has no CLI state (see +Consequences). Because the value is a grid (columns × lines) and not pixels, +`prepare_initial_grid` multiplies it by the cell it measures in the window's own +scale domain, so the result is correct at 100%, 125% and any other DPI without +the shell knowing the scale factor. Unset config keeps the 116×30 built-in +canvas; an oversized grid keeps the existing 95%-of-visible-display clamp, which +shrinks the grid rather than pushing the window off screen. + +## Rejected alternatives + +- Implementing `config.window.position` in the same pass. gpui only accepts + placement through `WindowOptions::window_bounds`, in logical pixels, with no + programmatic move and no `App`-level scale factor; the legacy shell hands winit + a `PhysicalPosition`. Feeding the user's raw numbers as logical would place the + window ~25% off at the reporter's 125% scaling, so `position` is left + unwired rather than shipped wrong. `startup_mode`, `decorations` and + `dynamic_title` are similarly untouched: they are not the reported symptom. +- Folding the field into `Settings`. `Settings` reloads on every settings-page + write, and a Lua `require`/eval on that path would re-execute user code per + save; the startup grid is by definition read once. Separate global, separate + lifecycle. +- Reading `config.window.dimensions` directly in `workspace_window_options` as + pixel math. That duplicates the chrome budget already owned by + `prepare_initial_grid` and cannot measure the cell before a window exists, so + the two paths would drift. +- Parsing Lua/TOML again inside `gpui_shell`. A second parser would diverge from + `pebrel config check` in precedence and error handling; reuse keeps one + authority. +- Extending the shell's existing TOML reader (`find_config_file` + + `load_merged_toml`) with a `window.dimensions` lookup. It cannot see a Lua + file, which is the format the reported config uses, and it deserializes into + `toml::Value` rather than `UiConfig`, so one key would need a third spelling + of the same config. +- Fixing only the legacy shell, or documenting the key as legacy-only. The + default product shell is the one users hit. + +## Consequences + +- The GPUI shell now depends on the app-level config loader (`config::source`, + `config::load_source`, and therefore mlua for Lua sources) during bootstrap. + Discovery order stays `pebrel.lua` → `pebrel.toml` → YAML, so a Lua file + shadows a TOML file for startup size exactly as it does for `config check`. +- `init()` performs one synchronous config read plus possible Lua evaluation on + the main thread before the first window opens. It was already doing file IO + there for `Settings::load_with_runtime`; startup is the only place a window + geometry can be known before display. +- A config file that fails to parse prints `[pebrel:gpui] failed to read window + config …` to stderr and falls back to the built-in canvas; the shell still + opens. +- Issue #312 is only half closed: window size now follows config, position still + does not. + +## Validation + +Local: `cargo fmt --all -- --check`, +`python3 scripts/check_architecture.py --base 7b0cedb` and +`python3 scripts/check_platform_cfg.py` (budget unchanged at 481) pass; no line +budget was raised, and `workspace.rs` is net −1 line because the grid math moved +to `config.rs`. + +`lua_window_dimensions_reach_the_startup_grid` fails before the change, because +`StartupWindow` did not exist; it pins the Lua source → `dimensions()` link. +`startup_grid_follows_window_dimensions` pins the three shell-side verdicts: +unset → built-in canvas, configured → exact grid, below-minimum → clamped. +Compile and test runs of the `gpui-test-support` cases happen in CI for the +reason under Evidence. + +## Supersedes + +None. + +## Revisit when + +gpui exposes a window-position API or an app-level scale factor, and +`config.window.position` can be honoured with the same physical-pixel contract +the legacy shell has. Also when the GPUI shell moves onto a shared config +loader with the rest of the app; at that point `StartupWindow` should read from +it rather than re-discovering. diff --git a/nebula_app/src/gpui_shell/config.rs b/nebula_app/src/gpui_shell/config.rs index 0ad33363b..97f1797b6 100644 --- a/nebula_app/src/gpui_shell/config.rs +++ b/nebula_app/src/gpui_shell/config.rs @@ -463,6 +463,63 @@ fn default_font_family() -> &'static str { crate::font_install::REQUIRED_FONT_FAMILY } +/// `config.window.dimensions`:启动窗口的网格行列。 +/// +/// 单独驻留而不是并入 [`Settings`],因为生命周期不同:`Settings` 随设置页写入 +/// 反复重载,启动网格按定义只在开窗时生效一次,而 Lua 配置求值不该出现在每次 +/// 保存设置的路径上。取值复用主应用的发现与解析(`pebrel.lua` 优先于 +/// `pebrel.toml`,YAML 同路),因此 `pebrel config check` 认过的键在此同义。 +#[derive(Default)] +pub(crate) struct StartupWindow { + pub dimensions: Option, +} + +impl Global for StartupWindow {} + +impl StartupWindow { + pub(crate) fn load() -> Self { + let Ok(Some(source)) = crate::config::source::discover(None) else { + return Self::default(); + }; + match crate::config::load_source(&source) { + Ok(loaded) => Self::from_config(&loaded.config), + Err(error) => { + super::try_write_stderr(format_args!( + "[pebrel:gpui] failed to read window config {}: {error}", + source.primary_path.display() + )); + Self::default() + }, + } + } + + /// `dimensions()` 自带「行列必须同时非零」的旧壳合同。 + fn from_config(config: &crate::config::UiConfig) -> Self { + Self { dimensions: config.window.dimensions() } + } +} + +/// 启动网格行列(浮点,供 cell 宽度直接相乘)。 +/// +/// 配置了 `config.window.dimensions` 就按它定形,与旧壳 `window_size` 同合同 +/// (行列各钳到终端最小可用值);未配置时用 `TerminalView` 的内建默认画布。 +pub(crate) fn startup_grid(cx: &App) -> (f32, f32) { + let builtin = || { + ( + f32::from(super::terminal::view::TerminalView::DEFAULT_GRID_COLUMNS), + f32::from(super::terminal::view::TerminalView::DEFAULT_GRID_LINES), + ) + }; + let Some(dimensions) = cx.try_global::().and_then(|window| window.dimensions) + else { + return builtin(); + }; + ( + dimensions.columns.max(nebula_terminal::term::MIN_COLUMNS) as f32, + dimensions.lines.max(nebula_terminal::term::MIN_SCREEN_LINES) as f32, + ) +} + /// 查找配置文件;顺序与 `nebula_app::config::installed_config` 一致。 /// `NEBULA_GPUI_CONFIG` 用于隔离测试:绝不能往用户真实配置目录写测试文件, /// 正式版 Nebula 正在监视它做热重载。 @@ -777,10 +834,11 @@ fn build_palette(raw: &RawColors) -> Palette { #[cfg(test)] mod tests { use super::{ - RawColors, Settings, apply_resolved_theme, apply_theme, build_palette, + RawColors, Settings, StartupWindow, apply_resolved_theme, apply_theme, build_palette, effective_font_sizes, effective_theme_line_height, resolve_ui_language, rgba8, - runtime_background, + runtime_background, startup_grid, }; + use crate::config::window::Dimensions; use crate::display::UiLanguage; use crate::gpui_shell::terminal::colors::Palette; use nebula_settings::{ @@ -798,6 +856,52 @@ mod tests { assert_eq!(resolve_ui_language(LanguagePref::EnUs), UiLanguage::EnUs); } + /// 用户写在 `pebrel.lua` 里的 `config.window.dimensions` 必须真的决定启动 + /// 网格;过去它只被 `pebrel config check` 的同一套解析认下,壳从不读取。 + #[test] + fn lua_window_dimensions_reach_the_startup_grid() { + use crate::config::lua::runtime::ReloadSignal; + + let temp = tempfile::tempdir().unwrap(); + let path = temp.path().join("pebrel.lua"); + std::fs::write( + &path, + "local pebrel = require 'pebrel'\n\ + local config = pebrel.config_builder()\n\ + config.window = { dimensions = { columns = 155, lines = 43 } }\n\ + return config\n", + ) + .unwrap(); + let loaded = crate::config::lua::load_lua_file(&path, ReloadSignal::default()).unwrap(); + + assert_eq!( + StartupWindow::from_config(&loaded.config).dimensions, + Some(Dimensions { columns: 155, lines: 43 }) + ); + } + + #[cfg(feature = "gpui-test-support")] + #[gpui::test] + fn startup_grid_follows_window_dimensions(cx: &mut gpui::TestAppContext) { + use crate::gpui_shell::terminal::view::TerminalView; + + let builtin = ( + f32::from(TerminalView::DEFAULT_GRID_COLUMNS), + f32::from(TerminalView::DEFAULT_GRID_LINES), + ); + let configured = |columns: usize, lines: usize| StartupWindow { + dimensions: Some(Dimensions { columns, lines }), + }; + cx.update(|cx| { + assert_eq!(startup_grid(cx), builtin); + cx.set_global(configured(155, 43)); + assert_eq!(startup_grid(cx), (155.0, 43.0)); + // 与旧壳 `window_size` 同合同:行列各钳到终端最小可用值。 + cx.set_global(configured(1, 1)); + assert_eq!(startup_grid(cx), (2.0, 1.0)); + }); + } + #[cfg(feature = "gpui-test-support")] #[gpui::test] fn render_preferences_read_current_settings(cx: &mut gpui::TestAppContext) { diff --git a/nebula_app/src/gpui_shell/mod.rs b/nebula_app/src/gpui_shell/mod.rs index 4b0bdba43..6de5b0d2e 100644 --- a/nebula_app/src/gpui_shell/mod.rs +++ b/nebula_app/src/gpui_shell/mod.rs @@ -216,6 +216,7 @@ fn init(cx: &mut App) { let settings = config::Settings::load_with_runtime(theme, runtime); gpui_component::set_locale(settings.ui_language.gpui_component_locale()); cx.set_global(settings); + cx.set_global(config::StartupWindow::load()); theme::apply_chrome_theme(cx); terminal::init(cx); workspace::init(cx); diff --git a/nebula_app/src/gpui_shell/workspace.rs b/nebula_app/src/gpui_shell/workspace.rs index 71aec1ff6..980957857 100644 --- a/nebula_app/src/gpui_shell/workspace.rs +++ b/nebula_app/src/gpui_shell/workspace.rs @@ -1133,14 +1133,14 @@ impl NebulaWorkspace { this } - /// 默认窗口尺寸 = 旧壳默认画布 116×30 的反推(`display` 的 - /// `Dimensions` 默认值)。画布按配置基准字号定形;持久化缩放只参与 - /// 随后的实际行列反推,不能把缩放后的 116 列全加到启动窗宽上。 - /// 布局链横向:网格 + 侧栏 + 卡缝 p_2×2(16) + - /// 终端水平内边距 24;纵向:网格 + 标题栏 34(gpui-component - /// TITLE_BAR_HEIGHT)+ 卡缝 16 + 终端垂直内边距 16。各加 2px 余量让 - /// 浮点 floor 不缩行列;放不下的屏幕按 95% 工作区收拢(网格随之变小, - /// 与旧壳"开不下就小"同义)。 + /// 启动窗口尺寸 = 启动网格 × 基准字号 cell + 布局链余量。启动网格取 + /// `config.window.dimensions`,未配置时回落到内建默认画布(旧壳 116×30)。 + /// 画布按配置基准字号定形;持久化缩放只参与随后的实际行列反推,不能把 + /// 缩放后的列数全加到启动窗宽上。布局链横向:网格 + 侧栏 + 卡缝 p_2×2(16) + /// + 终端水平内边距 24;纵向:网格 + 标题栏 34(gpui-component + /// TITLE_BAR_HEIGHT)+ 卡缝 16 + 终端垂直内边距 16。各加 2px 余量让浮点 + /// floor 不缩行列;放不下的屏幕按 95% 工作区收拢(网格随之变小,与旧壳 + /// "开不下就小"同义)。 fn prepare_initial_grid( window: &mut Window, cx: &mut App, @@ -1154,10 +1154,9 @@ impl NebulaWorkspace { let chrome_w = sidebar_width + 16.0 + 24.0 + 2.0; let chrome_h = 34.0 + 16.0 + 16.0 + 2.0; let (w, h) = if fit_window_to_default_grid { - let mut w = f32::from(TerminalView::DEFAULT_GRID_COLUMNS) * f32::from(startup_cell_w) - + chrome_w; - let mut h = - f32::from(TerminalView::DEFAULT_GRID_LINES) * f32::from(startup_line_h) + chrome_h; + let (columns, lines) = super::config::startup_grid(cx); + let mut w = columns * f32::from(startup_cell_w) + chrome_w; + let mut h = lines * f32::from(startup_line_h) + chrome_h; if let Some(display) = cx.primary_display() { let bounds = display.bounds().size; w = w.min(f32::from(bounds.width) * 0.95); From 0b38e7d13f5f452acd1ca9a87f3bbfe068c8ec23 Mon Sep 17 00:00:00 2001 From: GeekMr <140129782+WilliamWang1721@users.noreply.github.com> Date: Sun, 27 Sep 2026 19:39:44 +0800 Subject: [PATCH 2/5] fix(gpui): format startup geometry assertions --- .../gpui_shell/workspace/windowing/startup_geometry.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/nebula_app/src/gpui_shell/workspace/windowing/startup_geometry.rs b/nebula_app/src/gpui_shell/workspace/windowing/startup_geometry.rs index 8e57c1154..c2e77ae71 100644 --- a/nebula_app/src/gpui_shell/workspace/windowing/startup_geometry.rs +++ b/nebula_app/src/gpui_shell/workspace/windowing/startup_geometry.rs @@ -116,18 +116,12 @@ mod tests { f32::from(TerminalView::DEFAULT_GRID_COLUMNS), f32::from(TerminalView::DEFAULT_GRID_LINES), ); - assert_eq!( - default_size(metrics, grid, 230.0, None), - size(px(1200.0), px(668.0)) - ); + assert_eq!(default_size(metrics, grid, 230.0, None), size(px(1200.0), px(668.0))); assert_eq!( default_size(metrics, grid, 230.0, Some(size(px(1000.0), px(600.0)))), size(px(1000.0), px(600.0)), ); - assert_eq!( - default_size(metrics, grid, 300.0, None), - size(px(1270.0), px(668.0)), - ); + assert_eq!(default_size(metrics, grid, 300.0, None), size(px(1270.0), px(668.0)),); } #[test] From 0aea9b133ac1b4f177942dbe85bc20dd0416e6c3 Mon Sep 17 00:00:00 2001 From: GeekMr <140129782+WilliamWang1721@users.noreply.github.com> Date: Mon, 28 Sep 2026 20:10:40 +0800 Subject: [PATCH 3/5] fix(gpui): honor explicit startup config file --- .../2026-09-27-config-window-startup-size.md | 20 +++++------ nebula_app/src/gpui_shell/config.rs | 35 ++++++++++++++++--- nebula_app/src/gpui_shell/mod.rs | 7 ++-- nebula_app/src/main.rs | 7 +++- 4 files changed, 51 insertions(+), 18 deletions(-) diff --git a/architecture/notes/nebula_app/gpui_shell/2026-09-27-config-window-startup-size.md b/architecture/notes/nebula_app/gpui_shell/2026-09-27-config-window-startup-size.md index 801c9eb51..f7639ce19 100644 --- a/architecture/notes/nebula_app/gpui_shell/2026-09-27-config-window-startup-size.md +++ b/architecture/notes/nebula_app/gpui_shell/2026-09-27-config-window-startup-size.md @@ -45,11 +45,12 @@ default canvas, not a user value. ## Decision `gpui_shell::config::StartupWindow` holds the startup grid and is loaded once in -`init()` through `config::source::discover(None)` + `config::load_source` — the -pair `pebrel config check` uses, so a key accepted there means the same thing -here, and Lua, TOML and YAML share one path. `config::load` was not used: it -takes `&mut Options`, and the shell's `init(cx: &App)` has no CLI state (see -Consequences). Because the value is a grid (columns × lines) and not pixels, +`init()` through `config::source::discover(config_file)` + `config::load_source` — +the pair `pebrel config check` uses, so a key accepted there means the same thing +here, and Lua, TOML and YAML share one parser. `main` forwards the selected +`--config-file` path through `run_shell`; without that option, normal environment +and file discovery still applies. Because the value is a grid (columns × lines) +and not pixels, `prepare_initial_grid` multiplies it by the cell it measures in the window's own scale domain, so the result is correct at 100%, 125% and any other DPI without the shell knowing the scale factor. Unset config keeps the 116×30 built-in @@ -91,9 +92,8 @@ shrinks the grid rather than pushing the window off screen. Discovery order stays `pebrel.lua` → `pebrel.toml` → YAML, so a Lua file shadows a TOML file for startup size exactly as it does for `config check`. - `init()` performs one synchronous config read plus possible Lua evaluation on - the main thread before the first window opens. It was already doing file IO - there for `Settings::load_with_runtime`; startup is the only place a window - geometry can be known before display. + the main thread before the first window opens. The explicit CLI path reaches + this one-time load; settings-page writes do not re-evaluate it. - A config file that fails to parse prints `[pebrel:gpui] failed to read window config …` to stderr and falls back to the built-in canvas; the shell still opens. @@ -112,8 +112,8 @@ to `config.rs`. `StartupWindow` did not exist; it pins the Lua source → `dimensions()` link. `startup_grid_follows_window_dimensions` pins the three shell-side verdicts: unset → built-in canvas, configured → exact grid, below-minimum → clamped. -Compile and test runs of the `gpui-test-support` cases happen in CI for the -reason under Evidence. +`startup_window_uses_the_config_file_selected_by_cli` covers CLI parsing through +startup loading. Follow-up builds and tests run through the upstream PR Actions. ## Supersedes diff --git a/nebula_app/src/gpui_shell/config.rs b/nebula_app/src/gpui_shell/config.rs index 882b4ea56..fba90dbfc 100644 --- a/nebula_app/src/gpui_shell/config.rs +++ b/nebula_app/src/gpui_shell/config.rs @@ -474,8 +474,8 @@ fn default_font_family() -> &'static str { /// /// 单独驻留而不是并入 [`Settings`],因为生命周期不同:`Settings` 随设置页写入 /// 反复重载,启动网格按定义只在开窗时生效一次,而 Lua 配置求值不该出现在每次 -/// 保存设置的路径上。取值复用主应用的发现与解析(`pebrel.lua` 优先于 -/// `pebrel.toml`,YAML 同路),因此 `pebrel config check` 认过的键在此同义。 +/// 保存设置的路径上。显式 `--config-file` 优先;否则复用主应用发现顺序(`pebrel.lua` +/// 优先于 `pebrel.toml`,YAML 同路)和 `pebrel config check` 的同一解析器。 #[derive(Default)] pub(crate) struct StartupWindow { pub dimensions: Option, @@ -484,8 +484,8 @@ pub(crate) struct StartupWindow { impl Global for StartupWindow {} impl StartupWindow { - pub(crate) fn load() -> Self { - let Ok(Some(source)) = crate::config::source::discover(None) else { + pub(crate) fn load(config_file: Option) -> Self { + let Ok(Some(source)) = crate::config::source::discover(config_file) else { return Self::default(); }; match crate::config::load_source(&source) { @@ -863,6 +863,33 @@ mod tests { assert_eq!(resolve_ui_language(LanguagePref::EnUs), UiLanguage::EnUs); } + #[test] + fn startup_window_uses_the_config_file_selected_by_cli() { + use clap::Parser as _; + + let temp = tempfile::tempdir().unwrap(); + let path = temp.path().join("selected.lua"); + std::fs::write( + &path, + "local pebrel = require 'pebrel'\n\ + local config = pebrel.config_builder()\n\ + config.window = { dimensions = { columns = 123, lines = 37 } }\n\ + return config\n", + ) + .unwrap(); + let options = crate::cli::Options::try_parse_from([ + "pebrel", + "--config-file", + path.to_str().unwrap(), + ]) + .unwrap(); + + assert_eq!( + StartupWindow::load(options.config_file).dimensions, + Some(Dimensions { columns: 123, lines: 37 }) + ); + } + /// 用户写在 `pebrel.lua` 里的 `config.window.dimensions` 必须真的决定启动 /// 网格;过去它只被 `pebrel config check` 的同一套解析认下,壳从不读取。 #[test] diff --git a/nebula_app/src/gpui_shell/mod.rs b/nebula_app/src/gpui_shell/mod.rs index 95c5869ca..1a4daea56 100644 --- a/nebula_app/src/gpui_shell/mod.rs +++ b/nebula_app/src/gpui_shell/mod.rs @@ -82,6 +82,7 @@ pub fn run_shell( initial_cwd: Option, initial_command: Option, shell_id: Option, + config_file: Option, ) { if crate::platform::CAPABILITIES.self_update_install { match crate::update_download::handoff::installation_in_progress() { @@ -179,7 +180,7 @@ pub fn run_shell( let ai_events = crate::ai_hook::spawn_gpui_server(); #[cfg(windows)] crate::ai_hook::spawn_config_guard(); - init(cx); + init(cx, config_file); if initial_cwd.is_some() || !crate::platform::startup::start_hidden(&nebula_settings::RuntimeSettings::load()) { @@ -191,7 +192,7 @@ pub fn run_shell( } /// 组件库/主题/快捷键/用户配置的一次性初始化。 -fn init(cx: &mut App) { +fn init(cx: &mut App, config_file: Option) { crate::platform::acrylic::init(cx); // 三端都注册内嵌 Maple:Linux/macOS 的系统等宽字体没有 NF 图标码点, // 侧栏与提示符会出方框;字形同源也是跨平台截图能互相比对的前提。 @@ -218,7 +219,7 @@ fn init(cx: &mut App) { let settings = config::Settings::load_with_runtime(theme, runtime); gpui_component::set_locale(settings.ui_language.gpui_component_locale()); cx.set_global(settings); - cx.set_global(config::StartupWindow::load()); + cx.set_global(config::StartupWindow::load(config_file)); theme::apply_chrome_theme(cx); terminal::init(cx); workspace::init(cx); diff --git a/nebula_app/src/main.rs b/nebula_app/src/main.rs index 94b4aa02d..b5938b591 100644 --- a/nebula_app/src/main.rs +++ b/nebula_app/src/main.rs @@ -241,7 +241,12 @@ fn main() -> Result<(), Box> { if try_hand_over_to_resident(&options) { return Ok(()); } - gpui_shell::run_shell(initial_cwd, terminal_options.command(), shell_id); + gpui_shell::run_shell( + initial_cwd, + terminal_options.command(), + shell_id, + options.config_file.clone(), + ); return Ok(()); } From f4ef373d3603b38d33c5e5eeea49b2922de0671c Mon Sep 17 00:00:00 2001 From: GeekMr <140129782+WilliamWang1721@users.noreply.github.com> Date: Mon, 28 Sep 2026 21:28:07 +0800 Subject: [PATCH 4/5] fix(gpui): pass config path in init test callers --- nebula_app/src/gpui_shell/workspace/terminal_activity.rs | 2 +- nebula_app/src/gpui_shell/workspace/vcs_panel/list_tests.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nebula_app/src/gpui_shell/workspace/terminal_activity.rs b/nebula_app/src/gpui_shell/workspace/terminal_activity.rs index 36af3592d..c909180f3 100644 --- a/nebula_app/src/gpui_shell/workspace/terminal_activity.rs +++ b/nebula_app/src/gpui_shell/workspace/terminal_activity.rs @@ -165,7 +165,7 @@ mod tests { ) { cx.update(|cx| { gpui_component::init(cx); - crate::gpui_shell::init(cx); + crate::gpui_shell::init(cx, None); windowing::initialize(cx, crate::runtime_api::RuntimeHub::new()); cx.set_reduce_motion(true); }); diff --git a/nebula_app/src/gpui_shell/workspace/vcs_panel/list_tests.rs b/nebula_app/src/gpui_shell/workspace/vcs_panel/list_tests.rs index 2c822f735..20a3100bc 100644 --- a/nebula_app/src/gpui_shell/workspace/vcs_panel/list_tests.rs +++ b/nebula_app/src/gpui_shell/workspace/vcs_panel/list_tests.rs @@ -26,7 +26,7 @@ fn git_list_repaints_visible_rows_and_clicks_the_scrolled_path(cx: &mut TestAppC gpui_component::init(cx); crate::gpui_shell::math_view::register(cx); crate::gpui_shell::file_editor::init(cx); - crate::gpui_shell::init(cx); + crate::gpui_shell::init(cx, None); cx.set_reduce_motion(true); windowing::initialize(cx, crate::runtime_api::RuntimeHub::new()); }); From f40938aa9fdd57ac11288348fe33f60b8ee88073 Mon Sep 17 00:00:00 2001 From: GeekMr <140129782+WilliamWang1721@users.noreply.github.com> Date: Tue, 29 Sep 2026 02:23:16 +0800 Subject: [PATCH 5/5] ci: retrigger required checks after macOS log loss