Menu bar items drawn as in the menu bar show the wrong part of the menu bar after a display change
维护者通常 1 天内回复
评估
调研方向
Start with Sources/StableBar/MenuBarItemMirror.swift and trace how it caches SCWindow frames and chooses a window for capture. Compare those listed frames with the window server’s current bounds before capturing, then refresh the list when they differ. Done means live menu bar items remain aligned after a display disconnect or resolution change; issue #822 has an open linked pull request.
由索引模型根据 Issue 内容生成。
描述
What happens
Items of a Menu bar items widget shown As in the menu bar ("display": "live") draw a slice of the macOS menu bar that belongs to other items after a display is disconnected or changes resolution. On a MacBook whose ultrawide monitor was unplugged, CodexBar's place on the bar showed the ChatGPT and MeetingBar icons and MeetingBar's place showed part of the Wi‑Fi and Sound icons. Each picture still opens its own item, so clicking the MeetingBar icon opens CodexBar and clicking the speaker opens MeetingBar. It stays that way until StableBar restarts.
Steps to reproduce
- On macOS 27, show two neighboring menu bar items on the bar with As in the menu bar, such as CodexBar and MeetingBar.
- Start StableBar while the display's menu bar is shorter than it will be later: on an external display without a notch (30 pt menu bar), or with the built-in display at a smaller "Looks like" resolution such as 1352 × 845.
- Disconnect the external display, or switch back to the default resolution (1512 × 982, 33 pt menu bar on a notched MacBook).
Expected
Each item shows what it shows in the macOS menu bar, at any display arrangement.
Environment
StableBar 0.18.0-beta.20261118082113.1362, macOS 27.2.1, MacBook Pro built-in display, ultrawide external monitor (3440 pt wide).
Evidence
- The bar's log after the change shows ScreenCaptureKit capturing MenuBarAgent's window 118495 with
frame=(0,0,3440,30)every two seconds, while the window server reports the same window at(0,0,1512,33). - Reproduced with the built-in display alone: started the installed build at 1352 × 845, switched to 1512 × 982 and captured the bar: its live items showed fragments of the neighboring icons. A build with the fix drew them correctly in the same run.
Diagnosis
MenuBarItemMirror (Sources/StableBar/MenuBarItemMirror.swift) keeps the SCWindows it listed and lists again only when none of their frames contains the item. MenuBarAgent keeps the same window when displays change and resizes it, so the cached frame still contains the item and is never refreshed. The capture uses that frame for its size, which scales the image (here by 30/33), so every item's crop lands about 9% too far right. It only shows when the window grows taller than when it was listed; a smaller window leaves the crops in place.
Fix: compare the listed frames with the window server's current bounds before capturing, and list again when they differ.
Related
#640 added the live copies. #799 asks for a widget-wide Show setting, unrelated.
Triaged by Claude Code (claude-opus-5-5).
- 主要语言
- Swift
- 星标
- 184
- 派生
- 12
- 平均合并
- 3 小时 50 分钟
- 30 天内合并 PR
- 387
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Seb-GRAF/StableBar 的其他 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
enhancement
难度 4/5 3-5 天 新手友好度 52/100
维护者通常 1 天内回复
-
enhancement
难度 5/5 一周以上 新手友好度 30/100
维护者通常 1 天内回复
-
Allow the App Menu to display the frontmost app icon可能已有人在做 @khatami10 今天认领。 未关闭enhancement needs-triage
难度 3/5 1-2 天 新手友好度 35/100
维护者通常 1 天内回复
-
bug
难度 4/5 3-5 天 新手友好度 54/100
维护者通常 1 天内回复
查看 Seb-GRAF/StableBar 的全部 Issue
相似的 Issue
-
documentation ui
难度 2/5 1-3 小时 新手友好度 78/100
aydenjahola/Hush#41 ·
维护者通常 1 天内回复
-
good first issue help wanted testing
难度 1/5 1 小时以内 新手友好度 78/100
-
area:cli documentation good first issue priority:low
难度 1/5 1 小时以内 新手友好度 94/100
isaaclins/freesnitch#430 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
MasterJ93/ATProtoKit#354 ·
-
enhancement help wanted
难度 2/5 1-3 小时 新手友好度 84/100
heysidhant/appvanish#4 ·