29 lines
878 B
Swift
29 lines
878 B
Swift
import SwiftUI
|
|
|
|
public struct MenuBarStatusView: View {
|
|
public let cpuLoad: Double
|
|
public let memoryPercent: Double
|
|
|
|
public init(cpuLoad: Double, memoryPercent: Double) {
|
|
self.cpuLoad = cpuLoad
|
|
self.memoryPercent = memoryPercent
|
|
}
|
|
|
|
public var body: some View {
|
|
HStack(spacing: 5) {
|
|
Image(systemName: "cpu")
|
|
.font(.system(size: 11))
|
|
Text(String(format: "%.0f%%", cpuLoad))
|
|
.font(.system(size: 11, weight: .medium, design: .monospaced))
|
|
|
|
Text("•")
|
|
.foregroundColor(.secondary)
|
|
|
|
Image(systemName: "memorychip")
|
|
.font(.system(size: 11))
|
|
Text(String(format: "%.0f%%", memoryPercent))
|
|
.font(.system(size: 11, weight: .medium, design: .monospaced))
|
|
}
|
|
}
|
|
}
|