Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475public import ParcelConfigpublic import SwiftUI
@MainActorpublic struct HighlightPreferencesView: View, SearchableSettingsPane { private let model: SettingsModel
static let searchControls: [SettingsControl] = { [ SettingsControl( "settings.motion.highlight", section: .motion, title: String(localized: "Highlight style", table: "Highlights", bundle: .module), help: String( localized: "Highlights use your accent color in the gaps, never over window content. Glow becomes a solid border with Increase Contrast or Reduce Transparency.", table: "Highlights", bundle: .module), synonyms: [SettingsText.string("border")]), SettingsControl( "settings.motion.highlightWidth", section: .motion, title: String(localized: "Width (points)", table: "Highlights", bundle: .module), help: String(localized: "Choose a width from 2 to 6 points.", table: "Highlights", bundle: .module), synonyms: [SettingsText.string("border")]), ] }()
public init(model: SettingsModel) { self.model = model }
public var body: some View { Section(String(localized: "Highlights", table: "Highlights", bundle: .module)) { Picker( Self.control("settings.motion.highlight").title, selection: Binding( get: { model.configuration.motion.highlight }, set: { save(.string($0.rawValue), field: .highlight) }) ) { ForEach(ConfigHighlight.allCases, id: \.self) { style in Text(style.label).tag(style) } } .accessibilityIdentifier("settings.motion.highlight") .settingsSearchTarget(Self.control("settings.motion.highlight")) SettingsValueEditor( title: Self.control("settings.motion.highlightWidth").title, value: model.configuration.motion.highlightWidth.formatted( .number.grouping(.never).precision(.fractionLength(0...16))) ) { text in try await model.setValue(.float(try SettingsNumberParser.number(text)), for: .motion(.highlightWidth)) } .disabled(model.configuration.motion.highlight == .none) .accessibilityHint(Self.control("settings.motion.highlightWidth").searchText.help) .accessibilityIdentifier("settings.motion.highlightWidth") .settingsSearchTarget(Self.control("settings.motion.highlightWidth")) Text(Self.control("settings.motion.highlight").searchText.help) .font(.caption).foregroundStyle(.secondary) } }
private func save(_ value: TOMLValue, field: SettingsMotionField) { Task { do { try await model.setValue(value, for: .motion(field)) } catch { model.report(error) } } }}
extension ConfigHighlight { public var label: String { switch self { case .none: String(localized: "None", table: "Highlights", bundle: .module) case .active: String(localized: "Border active", table: "Highlights", bundle: .module) case .all: String(localized: "Border all", table: "Highlights", bundle: .module) case .glow: String(localized: "Glow", table: "Highlights", bundle: .module) } }}