Skip to content

[Bug] pebrel.lua 中配置的 config.window.dimensions / position 启动窗口大小未生效 (GPUI Shell 硬编码默认尺寸) #312

Closed

Description

@Cl0ud9

Operating system / 操作系统

Windows

OS version and display / 系统版本与显示

Windows 11 23H2 / 24H2, 125% scaling (DPI 120), 单显示器

Pebrel version / 版本号

1.9.1

How did you install Pebrel? / 安装方式

GitHub Release (.exe / .zip / .dmg / .AppImage / .deb)

Shell in the affected pane / 出问题的面板用的 Shell

PowerShell 7 (pwsh)

Program running in the pane / 面板里正在跑的程序

Nothing, plain shell prompt / 什么都没跑

Connection type / 连接方式

Local terminal / 本地终端

Affected area / 影响范围

Tabs / splits / session restore / window size — 标签页、分屏、会话恢复、窗口尺寸

Did it work in a previous version? / 旧版本是否正常?

Not sure / 不确定

Can you reproduce it? / 复现概率

Always (100%) / 必现

Steps to reproduce / 复现步骤

  1. 打开 %APPDATA%\Pebrel\pebrel.lua 配置文件。
  2. 配置启动窗口尺寸与坐标,例如:
    config.window = {
        startup_mode = 'Windowed',
        dimensions = {
            columns = 155,
            lines = 43,
        },
        position = {
            x = 197,
            y = 102,
        },
        decorations = 'Full',
        dynamic_title = true,
    }
  3. 运行 pebrel config check 验证配置,CLI 输出提示配置合法有效:
    Configuration is valid: C:\Users\<User>\AppData\Roaming\Pebrel\pebrel.lua
  4. 启动 Pebrel GUI。

Expected behavior / 期望结果

Pebrel 启动时应按照 pebrel.lua 中配置的网格行列(155 列 x 43 行)或窗口像素坐标(x=197, y=102)打开主窗口。

Actual behavior / 实际结果

配置完全不生效。Pebrel 启动时始终强制按默认尺寸(1080×720 逻辑像素)居中显示在主显示器中央。

Logs / screenshots / 日志或截图

$ pebrel config check
Configuration is valid: %USERPROFILE%\AppData\Roaming\Pebrel\pebrel.lua

注:非崩溃/挂起问题,本地无 crash log。该问题为窗口尺寸配置未被 GPUI 壳读取,启动时窗口强制按照 1080x720 逻辑像素初始化。

Non-default settings / 改过的设置

1. %APPDATA%\Pebrel\pebrel.lua 中修改的窗口配置:

config.window = {
    startup_mode = 'Windowed',
    dimensions = {
        columns = 155,
        lines = 43,
    },
    position = {
        x = 197,
        y = 102,
    },
    decorations = 'Full',
    dynamic_title = true,
}

2. %APPDATA%\Pebrel\pebrel_settings.txt 内容:

theme=CatppuccinFrappe
font_size=14.00
ui_font_size=13.00
cell_width_mode=compact
scrollback_lines=50000
blur=acrylic
opacity=0.40
shell=pwsh
tabs_position=sidebar
tab_reveal=slide

Before submitting / 提交前确认

  • I searched existing issues and did not find a duplicate / 已搜索,无重复
  • I tested with the latest release / 已用最新版本试过
  • I removed passwords, private keys, tokens and other secrets / 已删除敏感信息

Activity

  1. added
    bug缺陷:行为与预期不符 / something isn't working
    triage待维护者初审 / not yet reviewed
    on Sep 26, 2026
  2. added
    area: session会话恢复、标签页、工作区、窗口尺寸与位置
    os: windows仅 Windows 或与 ConPTY/Win32 相关
    on Sep 26, 2026
  3. WilliamWang1721 commented on Sep 27, 2026

    @WilliamWang1721
    Contributor

    结论:根因与修复进展

    先给一个明确的答复:这不是 DPI 换算错误,而是 GPUI 壳从来没有任何地方读取 config.window.*。 报告的观察(pebrel config check 说配置合法,GUI 却完全不生效)与代码状态一致:

    • pebrel config check 走 config::source::discover + config::load_source 这条解析链,所以 window.dimensions / window.position 会被正确认下;
    • 默认产品壳(GPUI,default = ["gpui-shell"])与这条链没有任何连接点:壳内唯一碰配置文件的是设置页的 TOML 读取(discover_toml,不含 Lua),窗口几何则固定为 1080×720 逻辑像素居中 + 由内建 116×30 画布反推启动网格。也就是说 config.window.* 在 GUI 侧没有读者。

    修复在 PR #313:启动时经上面同一套发现/解析入口读取一次 config.window.dimensions(Lua、TOML、YAML 一路通,优先级与 config check 一致),交给既有的 prepare_initial_grid 用「窗口自身缩放域里量到的 cell 尺寸 × 行列」换算成像素。因此 155×43 在 125%(DPI 120)下会按网格落位,而不是按 100% 的像素硬算;未配置时仍是原来的 116×30 默认画布,配置过大时沿用原有的 95% 工作区收拢钳制。

    @Kuddev 请复核。目前状态:本 PR 上游 CI 10/10 全绿(含 Tests (windows-2022)、Tests (windows-11-arm)、architecture-contracts、lint、pr-size),新增两个回归测试已通过;无冲突、分支未落后 main,只差 review。我在 PR 里刻意用了 Refs #312 而不是 Fixes,因为这一版只覆盖 dimensions,position 仍未生效——如果你觉得尺寸部分足以闭环,可以把 #312 关闭并关联 #313;position 我建议单独拆一个 issue 跟踪(原因见下)。

    关于 position(本 PR 未做)

    gpui 只允许在建窗时通过 WindowOptions::window_bounds 指定位置,单位是逻辑像素,既没有运行中移动窗口的接口,App 层也拿不到 scale factor;而旧壳是直接给 winit 传 PhysicalPosition。把 x = 197, y = 102 原样当逻辑像素传进去,在你报告的 125% 缩放下就会偏移约五分之一屏幕——与其交一个已知错误结果,这一版先不接。startup_mode、decorations、dynamic_title 同理仍是旧壳专属。需要的话我可以另开 issue 说明底层缺口。

    验收说明

    我这边无法给出 Windows 实机视觉验收:这台机器只有 Command Line Tools,gpui_macos 的 build script 缺 Xcode 的 metal 工具,本地无法编译/运行 GUI,所以编译与测试证据全部来自 PR 触发的上游 CI(详情见 #313 的 CI evidence 评论)。合并后如果你能拿 preview 包在 Windows 11 125% 下确认一次 155×43 的实际行列数,会很有帮助;另外 cell_width_mode=compact 与 font_size=14 会影响每个 cell 的像素宽度,因此窗口像素尺寸不会等于你按 1080×720 心算的值——生效的是网格行列。

  4. WilliamWang1721 commented on Oct 3, 2026

    @WilliamWang1721
    Contributor

    Implementation is available in PR #460 (#460).

    Addresses the remaining Windows startup-position and ordinary-window restoration paths; configured dimensions already had a separate implementation.

    Current upstream checks at 5e6d5035: all reported checks passed. Maintainer/Code Owner approval and any platform acceptance limitations described in the PR remain outstanding. This update does not close the issue.

  5. Kuddev commented on Oct 24, 2026

    @Kuddev
    Owner

    修复已由 #460(合并提交 14f93e2f)及此前已合入的网格尺寸实现 合入 main。

    已补齐本报告剩余的 Windows window.position 路径;显式网格尺寸/坐标优先于保存的普通窗口几何。

    验证:当前 main 的 Windows 原生 CI 已通过显式配置、窗口快照和坐标相关回归。具体 125% DPI 设备的人工观察没有在本次执行。

    已核对修复提交包含在 main 4e93a085 中,当前主线验证记录:https://github.com/Kuddev/pebrel/actions/runs/40069729178。按已合入修复关闭此 issue;若包含上述提交的构建仍有同样问题,可补充最小复现后重新打开。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: session会话恢复、标签页、工作区、窗口尺寸与位置bug缺陷:行为与预期不符 / something isn't workingos: windows仅 Windows 或与 ConPTY/Win32 相关triage待维护者初审 / not yet reviewed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions