CodexBar 是一个 macOS 菜单栏应用,用于查看本机 Codex 账号状态、额度、Token 用量、详细统计信息
Swift appkitcodexcodex-clideveloper-toolsmacosmacos-appmenu-bar-appopenai-codexproductivityswiftswiftuiusage-tracker
fix: 适配新 Swift 编译器并恢复析构优化
Bobd330f63537c1
diff --git a/CLAUDE.md b/CLAUDE.mdindex 916eff7..d96f701 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -292,7 +292,6 @@ Hook 子进程按天写入 `~/Library/Application Support/CodexBar/HookEvents/ev- 设置子面板的公共内边距、间距与外观度量从 `SettingsOptionsPanelMetrics` 取;通知、自动重置和防睡眠面板的下拉控件共用 `SettingsOptionsPicker`;主面板布局使用独立的 28 点拖拽行高且不使用下拉控件- 设置子面板的内容工厂必须走 `SettingsOptionsPanelController.makeContentController(_:rebuiltBy:)`,否则首次展开时原生 Switch 只剩一条空轨道;重建信号由它接在内容外面,内容视图不必知道 `SidePanelEntryCue`- 原因是 thumb 由 `WindowPortal` 投射而不是画在开关上,面板首次布局那一轮 portal 建不起来,而且不会自愈,只有一次内容重建才补得上;第二次展开正常是因为 hosting controller 常驻,复用了已经建好的那份-- 开关首次绘制由内容重建处理;`SidePanelSupport` 中的 `@_optimize(none)` 用于规避编译器崩溃- `MainPanelSettings.layout` 保存主面板区域顺序与显隐,至少保留一个区域。`updateHookEnabled(_:)` 在 Hook 关闭时隐藏任务区域,必要时开启账户;从关闭切换为开启时显示任务区域,启动恢复开启状态时保留用户布局。Hook 关闭时任务开关禁用,拖拽手柄可用- 主面板布局排序由手柄上的自定义 `DragGesture` 驱动,悬浮副本跟手移动,其他行按预览顺序实时让位,松手后才通过 `setSectionOrder(_:)` 保存最终顺序- 热力图详情面板跟随包含标题和方格矩阵的完整热力图区域定位,优先让两者顶边对齐;详情面板过高时通过 `SidePanelSupport.anchoredPosition` 上移到与主面板底边对齐,不能恢复为固定贴住主面板底边diff --git a/CodexBar/Controllers/HeatmapDetailPanelController.swift b/CodexBar/Controllers/HeatmapDetailPanelController.swiftindex 7a7a1e5..e9ac6e7 100644--- a/CodexBar/Controllers/HeatmapDetailPanelController.swift+++ b/CodexBar/Controllers/HeatmapDetailPanelController.swift@@ -83,7 +83,7 @@ final class HeatmapDetailPanelController {to: hidden,duration: SidePanelSupport.Metrics.drawerExitDuration,timing: .easeIn- ) {+ ) { [weak self] inTask { @MainActor [weak self] inguard let self,generation == visibilityGeneration else {@@ -209,7 +209,7 @@ final class HeatmapDetailPanelController {to: hidden,duration: SidePanelSupport.Metrics.drawerExitDuration,timing: .easeIn- ) {+ ) { [weak self] inTask { @MainActor [weak self] inguard let self,generation == visibilityGeneration,@@ -239,7 +239,7 @@ final class HeatmapDetailPanelController {to: 0,duration: SidePanelSupport.Metrics.drawerEnterDuration,timing: .easeOut- ) {+ ) { [weak self] inTask { @MainActor [weak self] inguard let self,generation == visibilityGeneration,diff --git a/CodexBar/Controllers/SidePanelSupport.swift b/CodexBar/Controllers/SidePanelSupport.swiftindex 9691390..d2ddb80 100644--- a/CodexBar/Controllers/SidePanelSupport.swift+++ b/CodexBar/Controllers/SidePanelSupport.swift@@ -273,7 +273,7 @@ final class SidePanelDrawerPresenter {to: hidden,duration: SidePanelSupport.Metrics.drawerExitDuration,timing: .easeIn- ) {+ ) { [weak self] inTask { @MainActor [weak self] inguard let self,generation == visibilityGeneration else {@@ -317,10 +317,6 @@ final class SidePanelContentHost<Root: View> {self.cornerRadius = cornerRadius}- /// Swift 6.3.3 的 EarlyPerfInliner 会在优化该泛型类型的合成析构函数时崩溃- @_optimize(none)- deinit {}-var contentView: NSView? {hostingController?.view}diff --git a/CodexBar/Views/Settings/CodexSourcePicker.swift b/CodexBar/Views/Settings/CodexSourcePicker.swiftindex a3ba2af..550aa16 100644--- a/CodexBar/Views/Settings/CodexSourcePicker.swift+++ b/CodexBar/Views/Settings/CodexSourcePicker.swift@@ -128,10 +128,6 @@ private struct SettingsDropdown<Option: Hashable & Sendable>: NSViewRepresentablfinal class AnchorView: NSView {var onWindowChange: (() -> Void)?- /// Swift 6.3.3 的 EarlyPerfInliner 无法正确优化该泛型嵌套类型的合成析构函数- @_optimize(none)- deinit {}-override func hitTest(_: NSPoint) -> NSView? {nil}@@ -164,10 +160,6 @@ private struct SettingsDropdown<Option: Hashable & Sendable>: NSViewRepresentablpopover.animates = false}- /// Swift 6.3.3 的 EarlyPerfInliner 无法正确优化该泛型嵌套类型的合成析构函数- @_optimize(none)- deinit {}-func scheduleReconcile() {guard reconcileTask == nil else { return }reconcileTask = Task { @MainActor [weak self] indiff --git a/README.en.md b/README.en.mdindex 14cad42..ef2c2b5 100644--- a/README.en.md+++ b/README.en.md@@ -9,6 +9,7 @@[简体中文](README.md) | English[](https://www.apple.com/macos/)+[](https://www.swift.org/)[](https://github.com/bob-zebedy/CodexBar/releases)[](https://github.com/bob-zebedy/CodexBar/releases)[](LICENSE)diff --git a/README.md b/README.mdindex 0f08247..c047adf 100644--- a/README.md+++ b/README.md@@ -9,6 +9,7 @@简体中文 | [English](README.en.md)[](https://www.apple.com/macos/)+[](https://www.swift.org/)[](https://github.com/bob-zebedy/CodexBar/releases)[](https://github.com/bob-zebedy/CodexBar/releases)[](LICENSE)