feat(menubar): 实现趋势面板外侧详情与三语外观设置
接入有界趋势、平滑滚动、菜单式外侧详情、底部操作与三语文案,装配独立外观设置和 Dock 生命周期。 合并跟随系统外观刷新、自选颜色入口与色块绘制修复,保留用户确认的配色联动、重启保存及滚动验收。 多场景视觉与长期资源验证边界仍记录于 docs。
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import Foundation
|
||||
|
||||
nonisolated struct TrendSample: Sendable {
|
||||
let date: Date
|
||||
let cpu: Double?
|
||||
let gpu: Double?
|
||||
let memory: Double?
|
||||
}
|
||||
|
||||
/// Bounded sampling history; no timer or UI visibility dependence.
|
||||
nonisolated struct MetricHistory: Sendable {
|
||||
static let capacity = 60
|
||||
private(set) var samples: [TrendSample] = []
|
||||
|
||||
mutating func append(_ snapshot: MetricsSnapshot) {
|
||||
samples.append(TrendSample(date: snapshot.date, cpu: snapshot.cpu?.usage,
|
||||
gpu: snapshot.gpuUsage, memory: snapshot.memory?.usage))
|
||||
if samples.count > Self.capacity { samples.removeFirst(samples.count - Self.capacity) }
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ nonisolated struct MetricsSnapshot: Sendable {
|
||||
var cpu: CPUMetrics?
|
||||
var memory: MemoryMetrics?
|
||||
var load: [Double] = []
|
||||
var uptime: TimeInterval = 0
|
||||
// GPU remains unavailable until a reliable IOReport subscription is validated.
|
||||
var gpuUsage: Double? = nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user