feat(menubar): 调整两排卡片布局并加入复合曲线与数值动效

This commit is contained in:
2026-11-03 10:10:44 +08:00
parent 0e8f598fe6
commit 906293b7c1
22 changed files with 400 additions and 122 deletions
@@ -10,6 +10,7 @@ nonisolated final class NetworkPathObserver: @unchecked Sendable {
private let monitor = NWPathMonitor()
private let lock = NSLock()
private var status: NetworkPathStatus?
private var primaryInterface: String?
init() {
monitor.pathUpdateHandler = { [weak self] path in
@@ -22,6 +23,7 @@ nonisolated final class NetworkPathObserver: @unchecked Sendable {
}
self.lock.lock()
self.status = next
self.primaryInterface = path.status == .satisfied ? path.availableInterfaces.first?.name : nil
self.lock.unlock()
}
monitor.start(queue: DispatchQueue(label: "cn.airnan.kymo.network-path"))
@@ -33,5 +35,11 @@ nonisolated final class NetworkPathObserver: @unchecked Sendable {
return status
}
func defaultInterface() -> String? {
lock.lock()
defer { lock.unlock() }
return primaryInterface
}
deinit { monitor.cancel() }
}
+1
View File
@@ -50,6 +50,7 @@ actor SystemSampler {
result.memory = MemoryMonitor.sample()
result.network = network.sample()
result.networkPath = networkPath.snapshot()
result.defaultNetworkInterface = networkPath.defaultInterface()
result.disk = DiskMonitor.sample()
result.diskIO = diskIO.sample()
result.battery = BatteryMonitor.sample()