Repository Public License
1// =============================================================================2// SP BOUCHER | SOFTWARE & RESEARCH3// ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project : ORIX Monitor9// File : App/Sources/Features/SystemViews.swift10// Description : Disk, network, power and thermal detail pages.11// Module : Features12// Repository : https://git.spboucher.ai/orix-monitor13// Created : 2026-11-2114// Last Modified : 2026-11-2115//16// =============================================================================17// AUTHOR & PROFESSIONAL AFFILIATION18// =============================================================================19//20// Author : Simon-Pierre Boucher21// Position : Professor of Finance22// Institution : Université du Québec en Outaouais (UQO)23// Department : Département des sciences administratives24// Organization : SP Boucher25//26// Website : https://spboucher.ai27// Git : https://git.spboucher.ai28//29// =============================================================================30// OFFICIAL CONTACT DIRECTORY31// =============================================================================32//33// General : info@spboucher.ai34// Professional : contact@spboucher.ai35// Direct : simon@spboucher.ai36// Research : research@spboucher.ai37// Development : dev@spboucher.ai38// Support : support@spboucher.ai39// Security/Admin : admin@spboucher.ai40// Notifications : notifications@spboucher.ai41//42// Preferred Contact: support@spboucher.ai43//44// =============================================================================45// COPYRIGHT & INTELLECTUAL PROPERTY46// =============================================================================47//48// Copyright (c) 202649// Simon-Pierre Boucher50//51// All rights reserved where applicable.52//53// This file is governed by the applicable project license,54// copyright notices, institutional agreements and relevant law.55//56// Unless expressly authorized by the applicable license or57// rights holder, copying, redistribution, sublicensing,58// publication and commercial exploitation are not permitted.59//60// Existing third-party rights and notices remain unaffected.61//62// =============================================================================63// CONFIDENTIALITY & SECURITY64// =============================================================================65//66// Classification : Public67// Distribution : Public repository; use is governed by the project license68// Security Contact : admin@spboucher.ai69//70// Access to this source does not independently grant permission71// to redistribute or disclose confidential materials.72//73// Do not embed credentials, private keys, access tokens,74// certificates or confidential personal information.75//76// =============================================================================77// LICENSE & MAINTENANCE78// =============================================================================79//80// License : Proprietary, all rights reserved (see license file)81// License File : LICENSE82// Maintainer : Simon-Pierre Boucher83// Technical Contact: dev@spboucher.ai84//85// =============================================================================86// END OF SP BOUCHER SOURCE HEADER87// =============================================================================8889import ORIXMonitorCore90import SwiftUI9192// MARK: - Disk9394struct DiskView: View {95 @Environment(MonitorModel.self) private var model96 @Environment(\.colorBlindSafe) private var safe9798 var body: some View {99 let f = model.format100 let color = MetricFamily.disk.color(colorBlindSafe: safe)101 let volumes = model.snapshot?.volumes ?? []102 let disks = model.snapshot?.disk?.disks ?? []103 Page {104 PageHeader(title: "Disk", subtitle: String(format: L("%1$d volumes · %2$d block devices"), volumes.count, disks.count), family: .disk)105 Card("Volumes", family: .disk) {106 Text("Volumes are logical: several can share one container and one physical disk, so their capacities must not be added together.")107 .font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary).fixedSize(horizontal: false, vertical: true)108 ForEach(volumes) { v in109 VStack(alignment: .leading, spacing: 5) {110 HStack {111 Image(systemName: v.isNetwork ? "externaldrive.connected.to.line.below" : v.isInternal ? "internaldrive" : "externaldrive").foregroundStyle(color).accessibilityHidden(true)112 Text(v.name).font(.system(size: 13, weight: .semibold))113 if v.isRoot { tag(L("Startup")) }114 if v.isReadOnly { tag(L("Read-only")) }115 if v.isRemovable { tag(L("Removable")) }116 Spacer()117 Text(String(format: L("%1$@ available of %2$@"), f.bytes(v.available), f.bytes(v.total))).font(ORIX.Typeface.value)118 }119 Meter(fraction: v.usedFraction, color: v.usedFraction > 0.9 ? ORIX.Palette.danger : color, height: 8)120 HStack(spacing: ORIX.Space.md) {121 Text(v.format)122 Text(model.displayPath(v.mountPoint))123 if let bsd = v.bsdName { Text(bsd + (v.containerBSDName.map { " ⊂ \($0)" } ?? "")) }124 if let connection = v.connection { Text(connection) }125 Spacer()126 Text(String(format: L("%@ free without purging"), f.bytes(v.free)))127 }128 .font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textSecondary)129 }130 .padding(.vertical, 4)131 .accessibilityElement(children: .combine)132 if v.id != volumes.last?.id { Divider() }133 }134 if volumes.isEmpty { Text("Collecting samples…").font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary) }135 }136 CardRow {137 Card("Throughput", family: .disk) {138 HStack(spacing: ORIX.Space.lg) {139 Readout(value: model.latest(.diskRead).map { f.rate($0) } ?? "—", caption: "Read", size: 24)140 Readout(value: model.latest(.diskWrite).map { f.rate($0) } ?? "—", caption: "Write", size: 24)141 }142 LiveChart(series: [143 LiveSeries(id: "read", name: L("Read"), color: color, points: model.series(.diskRead)),144 LiveSeries(id: "write", name: L("Write"), color: MetricFamily.gpu.color(colorBlindSafe: safe), points: model.series(.diskWrite)),145 ], format: { f.rate($0) })146 }147 Card("Available space, startup volume", family: .disk) {148 Readout(value: model.latest(.diskFree).map { f.bytes($0) } ?? "—", caption: "Includes space macOS can purge", size: 24)149 LiveChart(series: [LiveSeries(id: "free", name: L("Available"), color: color, points: model.series(.diskFree))], format: { f.bytes($0) })150 }151 }152 Card("Block devices", family: .disk) {153 Text("Activity is counted on physical devices. Disk images are listed but excluded from the totals, because their I/O already appears on the device that holds them.")154 .font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary).fixedSize(horizontal: false, vertical: true)155 Grid(alignment: .leading, horizontalSpacing: ORIX.Space.md, verticalSpacing: 6) {156 GridRow {157 ForEach([L("Device"), L("Model"), L("Connection"), L("Size"), L("Read"), L("Write"), L("Total read"), L("Total written")], id: \.self) {158 Text($0).font(ORIX.Typeface.label).foregroundStyle(ORIX.Palette.textSecondary)159 }160 }161 ForEach(disks) { d in162 GridRow {163 Text(d.bsdName).font(ORIX.Typeface.mono)164 Text(d.isDiskImage ? L("Disk image") : d.model).lineLimit(1)165 Text(d.isDiskImage ? "—" : [d.interconnect, d.mediumType].compactMap { $0 }.joined(separator: " · "))166 Text(f.bytes(d.size))167 Text(d.readRate.map { f.rate($0) } ?? "—")168 Text(d.writeRate.map { f.rate($0) } ?? "—")169 Text(f.bytes(d.totalBytesRead))170 Text(f.bytes(d.totalBytesWritten))171 }172 .font(ORIX.Typeface.value)173 .foregroundStyle(d.isDiskImage ? ORIX.Palette.textSecondary : ORIX.Palette.textPrimary)174 }175 }176 Text("Totals count from the last restart.").font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary)177 }178 Card("Not available", family: .disk) {179 UnavailableRow(label: L("SSD health, wear level and temperature"), reason: L("NVMe SMART data is only reachable through privileged or private interfaces. ORIX Monitor shows none rather than guess."))180 UnavailableRow(label: L("Per-process disk throughput"), reason: L("Only cumulative bytes per process are available; see the Processes page."))181 }182 SourcesCard(metrics: [.diskRead, .diskWrite, .diskFree])183 }184 }185186 private func tag(_ text: String) -> some View {187 Text(text).font(.system(size: 9, weight: .semibold)).textCase(.uppercase).padding(.horizontal, 5).padding(.vertical, 2)188 .foregroundStyle(ORIX.Palette.textSecondary).background(ORIX.Palette.surfaceRaised, in: Capsule())189 }190}191192// MARK: - Network193194struct NetworkView: View {195 @Environment(MonitorModel.self) private var model196 @Environment(AppSettings.self) private var settings197 @Environment(\.colorBlindSafe) private var safe198 @State private var latency: LatencyResult?199 @State private var isTesting = false200 @State private var showInactive = false201202 var body: some View {203 @Bindable var settings = settings204 let f = model.format205 let color = MetricFamily.network.color(colorBlindSafe: safe)206 let interfaces = (model.snapshot?.network?.interfaces ?? []).filter { showInactive || $0.isActive }207 Page {208 PageHeader(title: "Network", subtitle: primarySubtitle, family: .network)209 CardRow {210 Card("Throughput", family: .network) {211 HStack(spacing: ORIX.Space.lg) {212 Readout(value: model.latest(.netDown).map { f.rate($0) } ?? "—", caption: "Download", size: 26)213 Readout(value: model.latest(.netUp).map { f.rate($0) } ?? "—", caption: "Upload", size: 26)214 }215 LiveChart(series: [216 LiveSeries(id: "down", name: L("Download"), color: color, points: model.series(.netDown)),217 LiveSeries(id: "up", name: L("Upload"), color: MetricFamily.gpu.color(colorBlindSafe: safe), points: model.series(.netUp)),218 ], format: { f.rate($0) })219 Text("Totals add Wi-Fi, Ethernet and cellular links. VPN tunnels are listed below but not added, since their traffic already crosses one of those links.")220 .font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary).fixedSize(horizontal: false, vertical: true)221 }222 VStack(spacing: ORIX.Space.md) {223 Card("Wi-Fi link", family: .network) {224 if let w = model.wifi, w.isPoweredOn, w.rssi != 0 {225 KeyValueRow(L("Signal (RSSI)"), "\(w.rssi) dBm")226 KeyValueRow(L("Noise"), "\(w.noise) dBm")227 KeyValueRow(L("Signal-to-noise"), "\(w.rssi - w.noise) dB")228 KeyValueRow(L("Link rate"), "\(f.number(w.transmitRate, digits: 0)) Mbit/s")229 KeyValueRow(L("Channel"), [w.channel.map(String.init), w.band, w.phyMode].compactMap { $0 }.joined(separator: " · "))230 } else {231 Text(model.wifi?.isPoweredOn == false ? "Wi-Fi is off." : "Not connected to a Wi-Fi network.").font(.system(size: 12)).foregroundStyle(ORIX.Palette.textSecondary)232 }233 Text("The network name is not shown: reading it requires Location Services, which ORIX Monitor never asks for.")234 .font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary).fixedSize(horizontal: false, vertical: true)235 }236 Card("DNS and routing", family: .network) {237 KeyValueRow(L("Primary interface"), model.dns.primaryInterface ?? "—")238 KeyValueRow(L("Router"), model.dns.router.map(model.mask) ?? "—")239 KeyValueRow(L("DNS servers"), model.dns.servers.isEmpty ? "—" : model.dns.servers.map(model.mask).joined(separator: ", "))240 KeyValueRow(L("Search domains"), model.dns.searchDomains.isEmpty ? "—" : model.dns.searchDomains.map(model.mask).joined(separator: ", "))241 }242 }243 .frame(minWidth: 300, maxWidth: 400)244 }245 Card("Interfaces", family: .network) {246 Toggle("Show inactive interfaces", isOn: $showInactive).toggleStyle(.checkbox).font(.system(size: 12))247 Grid(alignment: .leading, horizontalSpacing: ORIX.Space.md, verticalSpacing: 6) {248 GridRow {249 ForEach([L("Interface"), L("Kind"), L("Status"), L("Addresses"), L("Download"), L("Upload"), L("Received"), L("Sent"), L("Errors")], id: \.self) {250 Text($0).font(ORIX.Typeface.label).foregroundStyle(ORIX.Palette.textSecondary)251 }252 }253 ForEach(interfaces) { i in254 GridRow {255 VStack(alignment: .leading, spacing: 0) {256 Text(i.displayName ?? i.name).lineLimit(1)257 if i.displayName != nil { Text(i.name).font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary) }258 }259 Text(kindName(i.kind))260 Text(i.isActive ? L("Active") : i.isUp ? L("Up, no address") : L("Down")).foregroundStyle(i.isActive ? ORIX.Palette.success : ORIX.Palette.textSecondary)261 Text((i.ipv4 + i.ipv6.prefix(1)).isEmpty ? "—" : (i.ipv4 + i.ipv6.prefix(1)).map(model.mask).joined(separator: "\n")).font(ORIX.Typeface.mono).lineLimit(3)262 Text(i.downRate.map { f.rate($0) } ?? "—")263 Text(i.upRate.map { f.rate($0) } ?? "—")264 Text(f.bytes(i.totalBytesIn))265 Text(f.bytes(i.totalBytesOut))266 Text("\(i.errorsIn + i.errorsOut)")267 }268 .font(ORIX.Typeface.value)269 }270 }271 }272 CardRow {273 Card("Latency test", family: .network) {274 HStack {275 TextField("Host", text: $settings.latencyHost).textFieldStyle(.roundedBorder).frame(maxWidth: 220)276 .accessibilityIdentifier("network.latencyHost")277 Button(isTesting ? "Testing…" : "Run Test") { runLatency() }.disabled(isTesting || settings.latencyHost.trimmingCharacters(in: .whitespaces).isEmpty)278 .accessibilityIdentifier("network.latencyRun")279 Spacer()280 }281 if let l = latency {282 if let average = l.average {283 HStack(spacing: ORIX.Space.lg) {284 Readout(value: "\(f.number(average, digits: 1)) ms", caption: "Average", size: 22)285 Readout(value: "\(f.number(l.minimum ?? 0, digits: 1)) ms", caption: "Fastest", size: 22)286 Readout(value: "\(f.number(l.maximum ?? 0, digits: 1)) ms", caption: "Slowest", size: 22)287 Readout(value: "\(l.failures)/\(l.attempts)", caption: "Failed", size: 22, color: l.failures > 0 ? ORIX.Palette.warning : ORIX.Palette.textPrimary)288 }289 } else {290 Label(String(format: L("No connection to %@ on port %d succeeded."), l.host, l.port), systemImage: "xmark.octagon").foregroundStyle(ORIX.Palette.danger)291 }292 }293 Text("Times five TCP handshakes to port 443 of the host you enter, only when you press the button. Nothing is sent after the handshake. This is connection time, which includes more than a ping's round trip.")294 .font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary).fixedSize(horizontal: false, vertical: true)295 }296 Card("Network changes", family: .network) {297 if model.networkEvents.isEmpty {298 Text("No change since ORIX Monitor started.").font(.system(size: 12)).foregroundStyle(ORIX.Palette.textSecondary)299 }300 ForEach(Array(model.networkEvents.prefix(8).enumerated()), id: \.offset) { _, event in301 HStack {302 Image(systemName: event.code == "network.online" ? "wifi" : "wifi.slash").foregroundStyle(event.code == "network.online" ? ORIX.Palette.success : ORIX.Palette.warning).accessibilityHidden(true)303 Text(event.code == "network.online" ? L("Connected") : L("Disconnected")).font(.system(size: 12, weight: .medium))304 Text(event.payload["interfaces"] ?? "").font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textSecondary)305 Spacer()306 Text(event.date, style: .time).font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textSecondary)307 }308 .accessibilityElement(children: .combine)309 }310 }311 }312 Card("Not available", family: .network) {313 UnavailableRow(label: L("Per-process network traffic"), reason: L("It needs a network extension or a private framework. ORIX Monitor does not intercept traffic."))314 }315 SourcesCard(metrics: [.netDown, .netUp])316 }317 }318319 private var primarySubtitle: String {320 guard let primary = model.dns.primaryInterface, let i = model.snapshot?.network?.interfaces.first(where: { $0.name == primary }) else { return L("No active connection") }321 return "\(i.displayName ?? i.name) · \(i.ipv4.first.map(model.mask) ?? "—")"322 }323324 private func kindName(_ kind: InterfaceKind) -> String {325 switch kind {326 case .wifi: L("Wi-Fi")327 case .ethernet: L("Ethernet")328 case .cellular: L("Cellular")329 case .tunnel: L("VPN / tunnel")330 case .bridge: L("Bridge")331 case .loopback: L("Loopback")332 case .other: L("Other")333 }334 }335336 private func runLatency() {337 let host = settings.latencyHost.trimmingCharacters(in: .whitespaces)338 isTesting = true339 Task {340 let result = await NetworkCollector.measureLatency(host: host)341 latency = result342 isTesting = false343 }344 }345}346347// MARK: - Power348349struct PowerView: View {350 @Environment(MonitorModel.self) private var model351 @Environment(\.colorBlindSafe) private var safe352353 var body: some View {354 let f = model.format355 let color = MetricFamily.power.color(colorBlindSafe: safe)356 let p = model.snapshot?.power357 Page {358 PageHeader(title: "Power", subtitle: p.map { PowerText.state($0) }, family: .power)359 if let p, p.hasBattery {360 CardRow {361 Card("Battery", family: .power) {362 Readout(value: p.charge.map { f.percent($0) } ?? "—", caption: LocalizedStringKey(PowerText.state(p)), size: 34)363 Meter(fraction: (p.charge ?? 0) / 100, color: (p.charge ?? 100) < 15 ? ORIX.Palette.danger : color, height: 8)364 KeyValueRow(L("Power source"), PowerText.source(p.source))365 if let m = p.minutesToEmpty { KeyValueRow(L("Time remaining"), f.duration(Double(m) * 60), quality: .estimated) }366 if let m = p.minutesToFull { KeyValueRow(L("Time until full"), f.duration(Double(m) * 60), quality: .estimated) }367 if p.minutesToEmpty == nil, p.minutesToFull == nil, !p.isCharged { KeyValueRow(L("Time remaining"), L("Calculating…"), quality: .estimated) }368 KeyValueRow(L("Low Power Mode"), p.lowPowerMode ? L("On") : L("Off"))369 if let watts = p.adapterWatts { KeyValueRow(L("Adapter"), "\(watts) W" + (p.adapterName.map { " · \($0)" } ?? "")) }370 }371 .frame(minWidth: 280, maxWidth: 380)372 Card("Charge", family: .power) {373 LiveChart(series: [LiveSeries(id: "charge", name: L("Battery charge"), color: color, points: model.series(.batteryCharge))], domain: 0...100, format: { f.percent($0) })374 Text("The live window covers the last few minutes. Longer charge and discharge history is on the History page.")375 .font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary)376 }377 }378 CardRow {379 Card("Health", family: .power, quality: .bestEffort) {380 if let health = p.health { KeyValueRow(L("Condition reported by macOS"), L(health)) }381 KeyValueRow(L("Cycle count"), p.cycleCount.map(String.init) ?? "—", quality: .bestEffort)382 KeyValueRow(L("Full-charge capacity"), p.maxCapacity.map { "\($0) mAh" } ?? "—", quality: .bestEffort)383 KeyValueRow(L("Design capacity"), p.designCapacity.map { "\($0) mAh" } ?? "—", quality: .bestEffort)384 KeyValueRow(L("Capacity relative to design"), p.capacityRatio.map { f.percent($0 * 100, digits: 1) } ?? "—", quality: .bestEffort)385 Text("These values come from the battery gauge's registry entry, whose property names Apple does not document. System Settings › Battery remains the reference for battery health.")386 .font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary).fixedSize(horizontal: false, vertical: true)387 }388 Card("Power flow", family: .power, quality: .bestEffort) {389 KeyValueRow(L("Battery flow"), p.batteryWatts.map { "\(f.number($0, digits: 1)) W" } ?? "—", quality: .bestEffort)390 KeyValueRow(L("Voltage"), p.voltage.map { "\(f.number($0, digits: 2)) V" } ?? "—", quality: .bestEffort)391 KeyValueRow(L("Current"), p.amperage.map { "\(f.number($0, digits: 2)) A" } ?? "—", quality: .bestEffort)392 KeyValueRow(L("System load (battery gauge)"), p.systemWatts.map { "\(f.number($0, digits: 1)) W" } ?? "—", quality: .bestEffort)393 LiveChart(series: [LiveSeries(id: "flow", name: L("Battery flow"), color: color, points: model.series(.batteryPower))], format: { "\(f.number($0, digits: 0)) W" }, height: 110)394 Text("Battery flow is voltage × current at the battery: negative while it discharges, positive while it charges. It is not the Mac's total consumption when an adapter is connected.")395 .font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary).fixedSize(horizontal: false, vertical: true)396 }397 }398 } else if let p {399 Card("Power source", family: .power) {400 Readout(value: PowerText.source(p.source), caption: "This Mac has no battery.", size: 26)401 KeyValueRow(L("Low Power Mode"), p.lowPowerMode ? L("On") : L("Off"))402 UnavailableRow(label: L("Power drawn by this Mac"), reason: L("Desktop Macs expose no power figure through supported system interfaces."))403 }404 }405 Card("Energy by process", family: .power) {406 let rows = (model.processes?.processes ?? []).filter { ($0.power ?? 0) > 0.01 }.sorted { ($0.power ?? 0) > ($1.power ?? 0) }.prefix(8)407 ForEach(Array(rows)) { process in408 KeyValueRow(process.name, "\(f.number(process.power ?? 0, digits: 2)) W")409 }410 if rows.isEmpty { Text("Collecting samples…").font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary) }411 Text("Average power the kernel billed to each of your processes over the last sampling interval (CPU and related work). It is an accounting figure, useful to compare processes, not a measurement at the wall.")412 .font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary).fixedSize(horizontal: false, vertical: true)413 }414 SourcesCard(metrics: [.batteryCharge, .batteryPower])415 }416 }417}418419// MARK: - Thermal420421struct ThermalView: View {422 @Environment(MonitorModel.self) private var model423 @Environment(\.colorBlindSafe) private var safe424 @State private var filter = ""425426 var body: some View {427 let f = model.format428 let level = model.snapshot?.thermal ?? .nominal429 let power = model.snapshot?.power430 Page {431 PageHeader(title: "Thermal & Sensors", subtitle: L("What macOS exposes, and what it does not"), family: .thermal)432 CardRow {433 Card("Thermal state", family: .thermal) {434 Readout(value: ThermalText.name(level), caption: "The system's own assessment", size: 32, color: ThermalText.color(level))435 ThermalScale(level: level)436 Text(ThermalText.explanation(level)).font(.system(size: 12)).foregroundStyle(ORIX.Palette.textSecondary).fixedSize(horizontal: false, vertical: true)437 }438 .frame(minWidth: 260, maxWidth: 360)439 Card("Thermal state over time", family: .thermal) {440 LiveChart(series: [LiveSeries(id: "thermal", name: L("Thermal state"), color: MetricFamily.thermal.color(colorBlindSafe: safe), points: model.series(.thermalState))],441 domain: 0...3, format: { ThermalText.name(ThermalLevel(rawValue: Int($0.rounded())) ?? .nominal) }, height: 150, ticks: [0, 1, 2, 3])442 }443 }444 Card("Temperatures and fans", family: .thermal) {445 if let t = power?.temperature {446 KeyValueRow(L("Battery temperature"), f.temperature(t), quality: .bestEffort)447 } else if power?.hasBattery == true {448 UnavailableRow(label: L("Battery temperature"), reason: L("The battery gauge on this Mac and macOS version publishes no temperature."))449 }450 UnavailableRow(label: L("CPU temperature"))451 UnavailableRow(label: L("GPU temperature"))452 UnavailableRow(label: L("Fan speed"))453 Text("Chip temperatures and fan speeds exist only behind the System Management Controller and private sensor services. ORIX Monitor does not use them: they are undocumented, differ between Mac models, and can break with any update. The thermal state above is the supported signal.")454 .font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary).fixedSize(horizontal: false, vertical: true)455 }456 Card("Sensor and metric availability on this Mac") {457 TextField("Filter", text: $filter).textFieldStyle(.roundedBorder).frame(maxWidth: 240)458 let rows = model.capabilities.filter { filter.isEmpty || L($0.name).localizedCaseInsensitiveContains(filter) || L($0.category).localizedCaseInsensitiveContains(filter) }459 Grid(alignment: .leading, horizontalSpacing: ORIX.Space.md, verticalSpacing: 7) {460 GridRow {461 ForEach([L("Metric"), L("Area"), L("Access"), L("On this Mac"), L("Source")], id: \.self) {462 Text($0).font(ORIX.Typeface.label).foregroundStyle(ORIX.Palette.textSecondary)463 }464 }465 ForEach(rows) { c in466 GridRow(alignment: .top) {467 VStack(alignment: .leading, spacing: 1) {468 Text(L(c.name)).font(.system(size: 12, weight: .medium))469 if !c.note.isEmpty { Text(L(c.note)).font(ORIX.Typeface.caption).foregroundStyle(ORIX.Palette.textTertiary).fixedSize(horizontal: false, vertical: true) }470 }471 Text(L(c.category)).font(.system(size: 12)).foregroundStyle(ORIX.Palette.textSecondary)472 Text(CapabilityText.name(c.classification)).font(.system(size: 12))473 Label(c.present ? L("Available") : L("Not available"), systemImage: c.present ? "checkmark.circle.fill" : "minus.circle")474 .font(.system(size: 12)).foregroundStyle(c.present ? ORIX.Palette.success : ORIX.Palette.textTertiary)475 Text(c.source).font(ORIX.Typeface.mono).foregroundStyle(ORIX.Palette.textSecondary).textSelection(.enabled)476 }477 .accessibilityElement(children: .combine)478 }479 }480 }481 SourcesCard(metrics: [.thermalState, .batteryTemperature])482 }483 }484}485486enum CapabilityText {487 static func name(_ c: CapabilityClass) -> String {488 switch c {489 case .publicAPI: L("Public API")490 case .userAuthorization: L("Needs your permission")491 case .systemCommand: L("System command")492 case .privilegedHelper: L("Needs a privileged helper")493 case .unavailable: L("Not exposed")494 case .estimated: L("Estimate")495 case .bestEffort: L("Best effort")496 }497 }498}499