fix(settings): 调整系统式设置布局并修正应用图标留白
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 520 B After Width: | Height: | Size: 443 B |
|
Before Width: | Height: | Size: 1002 B After Width: | Height: | Size: 828 B |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1002 B After Width: | Height: | Size: 828 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 46 KiB |
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><rect x="80" y="80" width="864" height="864" rx="192" fill="#fff"/><path d="M512 85.333333c235.648 0 426.666667 191.018667 426.666667 426.666667s-191.018667 426.666667-426.666667 426.666667S85.333333 747.648 85.333333 512 276.352 85.333333 512 85.333333z m196.096 230.570667a25.429333 25.429333 0 0 0-32.554667-2.858667c-123.306667 86.528-192.853333 137.813333-208.810666 153.685334a64 64 0 0 0 90.538666 90.538666c9.344-9.386667 60.501333-78.976 153.514667-208.938666a25.173333 25.173333 0 0 0-2.688-32.426667zM746.666667 469.333333a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m-469.333334 0a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m98.901334-153.429333a42.666667 42.666667 0 1 0-60.330667 60.330667 42.666667 42.666667 0 0 0 60.330667-60.330667zM512 234.666667a42.666667 42.666667 0 1 0 0 85.333333 42.666667 42.666667 0 0 0 0-85.333333z" transform="translate(154 154) scale(.7)" fill="#2c2c2c"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><rect width="1024" height="1024" fill="#fff"/><path d="M512 85.333333c235.648 0 426.666667 191.018667 426.666667 426.666667s-191.018667 426.666667-426.666667 426.666667S85.333333 747.648 85.333333 512 276.352 85.333333 512 85.333333z m196.096 230.570667a25.429333 25.429333 0 0 0-32.554667-2.858667c-123.306667 86.528-192.853333 137.813333-208.810666 153.685334a64 64 0 0 0 90.538666 90.538666c9.344-9.386667 60.501333-78.976 153.514667-208.938666a25.173333 25.173333 0 0 0-2.688-32.426667zM746.666667 469.333333a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m-469.333334 0a42.666667 42.666667 0 1 0 0 85.333334 42.666667 42.666667 0 0 0 0-85.333334z m98.901334-153.429333a42.666667 42.666667 0 1 0-60.330667 60.330667 42.666667 42.666667 0 0 0 60.330667-60.330667zM512 234.666667a42.666667 42.666667 0 1 0 0 85.333333 42.666667 42.666667 0 0 0 0-85.333333z" transform="translate(154 154) scale(.7)" fill="#2c2c2c"/></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@@ -18,31 +18,16 @@ struct AppearanceSettingsView: View {
|
||||
}
|
||||
}
|
||||
.listStyle(.sidebar)
|
||||
.navigationSplitViewColumnWidth(min: 160, ideal: 175, max: 200)
|
||||
.safeAreaInset(edge: .bottom) {
|
||||
HStack(spacing: 8) {
|
||||
Image("BrandLogo").resizable().frame(width: 34, height: 34)
|
||||
Text(verbatim: "Kymo").font(.headline)
|
||||
Spacer()
|
||||
}
|
||||
.padding(12)
|
||||
}
|
||||
.navigationSplitViewColumnWidth(min: 180, ideal: 205, max: 240)
|
||||
} detail: {
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 22) {
|
||||
Text((selection ?? .appearance).title)
|
||||
.font(.largeTitle.bold())
|
||||
switch selection ?? .appearance {
|
||||
case .appearance: appearancePage
|
||||
case .language: languagePage
|
||||
case .about: aboutPage
|
||||
}
|
||||
Group {
|
||||
switch selectedPage {
|
||||
case .appearance: appearancePage
|
||||
case .language: languagePage
|
||||
case .about: aboutPage
|
||||
}
|
||||
.frame(maxWidth: 480, alignment: .leading)
|
||||
.padding(28)
|
||||
.frame(maxWidth: .infinity, alignment: .topLeading)
|
||||
}
|
||||
.background(.regularMaterial)
|
||||
.navigationTitle(selectedPage.title)
|
||||
}
|
||||
.navigationSplitViewStyle(.balanced)
|
||||
.background(SettingsWindowLifecycle(title: AppLocalization.string("settings.title", locale: locale),
|
||||
@@ -58,82 +43,101 @@ struct AppearanceSettingsView: View {
|
||||
} else { colorPicker.close() }
|
||||
}
|
||||
.onChange(of: selection) { _, _ in colorPicker.close() }
|
||||
.frame(minWidth: 680, idealWidth: 740, minHeight: 450, idealHeight: 500)
|
||||
.frame(minWidth: 720, idealWidth: 780, minHeight: 460, idealHeight: 540)
|
||||
.modifier(AppearanceStyle(preferences: preferences))
|
||||
}
|
||||
|
||||
private var selectedPage: SettingsPage { selection ?? .appearance }
|
||||
|
||||
private var appearancePage: some View {
|
||||
glassCard {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
Text("appearance.title").font(.headline)
|
||||
Picker("appearance.title", selection: $preferences.appearance) {
|
||||
Text("appearance.system").tag(AppAppearance.system)
|
||||
Text("appearance.light").tag(AppAppearance.light)
|
||||
Text("appearance.dark").tag(AppAppearance.dark)
|
||||
Form {
|
||||
Section {
|
||||
LabeledContent("appearance.title") {
|
||||
Picker("appearance.title", selection: $preferences.appearance) {
|
||||
Text("appearance.system").tag(AppAppearance.system)
|
||||
Text("appearance.light").tag(AppAppearance.light)
|
||||
Text("appearance.dark").tag(AppAppearance.dark)
|
||||
}
|
||||
.labelsHidden()
|
||||
.pickerStyle(.segmented)
|
||||
.fixedSize()
|
||||
}
|
||||
.labelsHidden()
|
||||
.pickerStyle(.segmented)
|
||||
}
|
||||
Divider()
|
||||
HStack {
|
||||
Text("accent.title").font(.headline)
|
||||
Spacer()
|
||||
Picker("accent.title", selection: $preferences.accent) {
|
||||
Text("accent.system").tag(AccentChoice.system)
|
||||
Text("accent.blue").tag(AccentChoice.blue)
|
||||
Text("accent.purple").tag(AccentChoice.purple)
|
||||
Text("accent.teal").tag(AccentChoice.teal)
|
||||
Text("accent.green").tag(AccentChoice.green)
|
||||
Text("accent.orange").tag(AccentChoice.orange)
|
||||
Text("accent.pink").tag(AccentChoice.pink)
|
||||
Text("accent.custom").tag(AccentChoice.custom)
|
||||
LabeledContent("accent.title") {
|
||||
Picker("accent.title", selection: $preferences.accent) {
|
||||
Text("accent.system").tag(AccentChoice.system)
|
||||
Text("accent.blue").tag(AccentChoice.blue)
|
||||
Text("accent.purple").tag(AccentChoice.purple)
|
||||
Text("accent.teal").tag(AccentChoice.teal)
|
||||
Text("accent.green").tag(AccentChoice.green)
|
||||
Text("accent.orange").tag(AccentChoice.orange)
|
||||
Text("accent.pink").tag(AccentChoice.pink)
|
||||
Text("accent.custom").tag(AccentChoice.custom)
|
||||
}
|
||||
.labelsHidden()
|
||||
.fixedSize()
|
||||
}
|
||||
.labelsHidden()
|
||||
.fixedSize()
|
||||
.buttonStyle(.glass)
|
||||
}
|
||||
if preferences.accent == .custom {
|
||||
Divider()
|
||||
HStack {
|
||||
Text("accent.custom").font(.headline)
|
||||
Spacer()
|
||||
CustomColorWell(preferences: preferences, picker: colorPicker)
|
||||
.frame(width: 44, height: 26)
|
||||
if preferences.accent == .custom {
|
||||
LabeledContent("accent.custom") {
|
||||
CustomColorWell(preferences: preferences, picker: colorPicker)
|
||||
.frame(width: 44, height: 26)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.top, 6)
|
||||
}
|
||||
|
||||
private var languagePage: some View {
|
||||
glassCard {
|
||||
HStack {
|
||||
Text("language.title").font(.headline)
|
||||
Spacer()
|
||||
Picker("language.title", selection: $language.language) {
|
||||
Text("language.system").tag(AppLanguage.system)
|
||||
Text(verbatim: "简体中文").tag(AppLanguage.simplifiedChinese)
|
||||
Text(verbatim: "繁體中文").tag(AppLanguage.traditionalChinese)
|
||||
Text(verbatim: "English").tag(AppLanguage.english)
|
||||
Form {
|
||||
Section {
|
||||
LabeledContent("language.title") {
|
||||
Picker("language.title", selection: $language.language) {
|
||||
Text("language.system").tag(AppLanguage.system)
|
||||
Text(verbatim: "简体中文").tag(AppLanguage.simplifiedChinese)
|
||||
Text(verbatim: "繁體中文").tag(AppLanguage.traditionalChinese)
|
||||
Text(verbatim: "English").tag(AppLanguage.english)
|
||||
}
|
||||
.labelsHidden()
|
||||
.fixedSize()
|
||||
}
|
||||
.labelsHidden()
|
||||
.fixedSize()
|
||||
.buttonStyle(.glass)
|
||||
Text("language.immediate")
|
||||
.font(.callout)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
Text("language.immediate").font(.callout).foregroundStyle(.secondary)
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.top, 6)
|
||||
}
|
||||
|
||||
private var aboutPage: some View {
|
||||
glassCard {
|
||||
VStack(spacing: 16) {
|
||||
Image("BrandLogo").resizable().scaledToFit().frame(width: 112, height: 112)
|
||||
.accessibilityHidden(true)
|
||||
Text(verbatim: "Kymo").font(.system(size: 28, weight: .bold))
|
||||
Text("about.version \(version)").font(.callout).foregroundStyle(.secondary)
|
||||
Text("about.description").multilineTextAlignment(.center).foregroundStyle(.secondary)
|
||||
Form {
|
||||
Section {
|
||||
HStack(alignment: .top, spacing: 18) {
|
||||
Image("BrandLogo")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 88, height: 88)
|
||||
.accessibilityHidden(true)
|
||||
VStack(alignment: .leading, spacing: 7) {
|
||||
Text(verbatim: "Kymo").font(.title2.bold())
|
||||
Text("about.version \(version)")
|
||||
.font(.callout)
|
||||
.foregroundStyle(.secondary)
|
||||
Text("about.description")
|
||||
.foregroundStyle(.secondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
Spacer(minLength: 0)
|
||||
}
|
||||
.padding(.vertical, 8)
|
||||
}
|
||||
.frame(maxWidth: .infinity).padding(.vertical, 16)
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.top, 6)
|
||||
}
|
||||
|
||||
private var version: String {
|
||||
@@ -142,13 +146,6 @@ struct AppearanceSettingsView: View {
|
||||
let build = bundle.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "--"
|
||||
return "\(version) (\(build))"
|
||||
}
|
||||
|
||||
private func glassCard<Content: View>(@ViewBuilder content: () -> Content) -> some View {
|
||||
VStack(alignment: .leading, spacing: 18, content: content)
|
||||
.padding(22)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.glassEffect(.regular, in: .rect(cornerRadius: 22))
|
||||
}
|
||||
}
|
||||
|
||||
private enum SettingsPage: String, CaseIterable, Identifiable {
|
||||
|
||||
@@ -31,9 +31,6 @@ struct SettingsWindowLifecycle: NSViewRepresentable {
|
||||
tokens.removeAll()
|
||||
guard let window else { return }
|
||||
window.title = title
|
||||
window.titlebarAppearsTransparent = true
|
||||
window.isOpaque = false
|
||||
window.backgroundColor = .clear
|
||||
schedulePresentation()
|
||||
tokens.append(NotificationCenter.default.addObserver(forName: NSApplication.didBecomeActiveNotification,
|
||||
object: NSApp, queue: .main) { [weak self] _ in
|
||||
|
||||