feat(menubar): 支持固定居中面板与独立刷新频率及图表浮层

This commit is contained in:
2026-11-03 11:30:37 +08:00
parent 906293b7c1
commit 36b8e32af3
33 changed files with 1403 additions and 118 deletions
@@ -5,6 +5,7 @@ import AppKit
struct AppearanceSettingsView: View {
@Bindable var preferences: AppearancePreferences
@Bindable var language: LanguagePreferences
@Bindable var sampling: SamplingPreferences
let presentation: SettingsPresentation
@Environment(\.locale) private var locale
@State private var colorPicker = CustomColorPicker()
@@ -24,6 +25,7 @@ struct AppearanceSettingsView: View {
switch selectedPage {
case .appearance: appearancePage
case .language: languagePage
case .monitoring: monitoringPage
case .about: aboutPage
}
}
@@ -82,6 +84,17 @@ struct AppearanceSettingsView: View {
.padding(.top, 6)
}
private var monitoringPage: some View {
Form {
Section {
LabeledContent("sampling.background") {
IntervalControl(milliseconds: $sampling.backgroundMilliseconds)
}
Text("sampling.backgroundHelp").font(.callout).foregroundStyle(.secondary)
}
}.formStyle(.grouped).padding(.horizontal, 12).padding(.top, 6)
}
private var languagePage: some View {
Form {
Section {
@@ -207,12 +220,13 @@ private extension AppAppearance {
}
private enum SettingsPage: String, CaseIterable, Identifiable {
case appearance, language, about
case appearance, language, monitoring, about
var id: String { rawValue }
var title: LocalizedStringKey {
switch self {
case .appearance: "settings.appearance"
case .language: "settings.language"
case .monitoring: "settings.monitoring"
case .about: "settings.about"
}
}
@@ -220,6 +234,7 @@ private enum SettingsPage: String, CaseIterable, Identifiable {
switch self {
case .appearance: "paintpalette"
case .language: "globe"
case .monitoring: "timer"
case .about: "info.circle"
}
}