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

@@ -160,12 +160,6 @@ public class CPU: 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: "CPU@LoadReader")
WidgetCenter.shared.reloadTimelines(ofKind: CPU_entry.kind)
}
self.menuBar.widgets.filter{ $0.isActive }.forEach { (w: SWidget) in
switch w.item {
case let widget as Mini: widget.setValue(value.totalUsage)
@@ -213,5 +207,11 @@ public class CPU: Module {
default: break
}
}
if #available(macOS 11.0, *) {
guard let blobData = try? JSONEncoder().encode(value) else { return }
self.userDefaults?.set(blobData, forKey: "CPU@LoadReader")
WidgetCenter.shared.reloadTimelines(ofKind: CPU_entry.kind)
}
}
}

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)
}
}
}

View File

@@ -2746,7 +2746,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 2.11.0;
MARKETING_VERSION = 2.11.1;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2785,7 +2785,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 2.11.0;
MARKETING_VERSION = 2.11.1;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>575</string>
<string>577</string>
<key>Description</key>
<string>Simple macOS system monitor in your menu bar</string>
<key>LSApplicationCategoryType</key>