Files
Kymo/kymo/Features/MenuBar/MenuBarLabel.swift
T
wangairnan 0c846a2127 feat(menubar): 实现趋势面板外侧详情与三语外观设置
接入有界趋势、平滑滚动、菜单式外侧详情、底部操作与三语文案,装配独立外观设置和 Dock 生命周期。
合并跟随系统外观刷新、自选颜色入口与色块绘制修复,保留用户确认的配色联动、重启保存及滚动验收。
多场景视觉与长期资源验证边界仍记录于 docs。
2026-10-30 00:45:34 +08:00

27 lines
808 B
Swift

import SwiftUI
struct MenuBarLabel: View {
let snapshot: MetricsSnapshot
var body: some View {
// Use one native image/title label: the previous multi-view HStack showed
// only its first image and percentage in the user-verified menu bar.
Label {
Text(verbatim: title)
.monospacedDigit()
} icon: {
Image(systemName: "gauge")
}
.labelStyle(.titleAndIcon)
}
private var title: String {
var items = ["CPU \(MetricFormat.percent(snapshot.cpu?.usage))"]
if let gpu = snapshot.gpuUsage {
items.append("GPU \(MetricFormat.percent(gpu))")
}
items.append("MEM \(MetricFormat.percent(snapshot.memory?.usage))")
return items.joined(separator: " · ")
}
}