fix: fixed CPU widget update for intel based Macs (#2024)

This commit is contained in:
Serhiy Mytrovtsiy
2024-07-08 13:14:50 +02:00
parent 0caf14180d
commit 1d4b411ca0
4 changed files with 15 additions and 15 deletions

View File

@@ -135,12 +135,6 @@ public class RAM: Module {
self.portalView.callback(value)
self.notificationsView.loadCallback(value)
if #available(macOS 11.0, *) {
guard let blobData = try? JSONEncoder().encode(value) else { return }
self.userDefaults?.set(blobData, forKey: "RAM@UsageReader")
WidgetCenter.shared.reloadTimelines(ofKind: RAM_entry.kind)
}
let total: Double = value.total == 0 ? 1 : value.total
self.menuBar.widgets.filter{ $0.isActive }.forEach { (w: SWidget) in
switch w.item {
@@ -182,5 +176,11 @@ public class RAM: Module {
default: break
}
}
if #available(macOS 11.0, *) {
guard let blobData = try? JSONEncoder().encode(value) else { return }
self.userDefaults?.set(blobData, forKey: "RAM@UsageReader")
WidgetCenter.shared.reloadTimelines(ofKind: RAM_entry.kind)
}
}
}