diff --git a/eul.xcodeproj/project.pbxproj b/eul.xcodeproj/project.pbxproj index 0eb405b6..9c3b6588 100644 --- a/eul.xcodeproj/project.pbxproj +++ b/eul.xcodeproj/project.pbxproj @@ -1522,7 +1522,7 @@ CODE_SIGN_ENTITLEMENTS = MemoryWidget/MemoryWidget.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_TEAM = M8G2RFZVFV; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = MemoryWidget/Info.plist; @@ -1532,7 +1532,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.4.7; + MARKETING_VERSION = 1.4.8; PRODUCT_BUNDLE_IDENTIFIER = com.gaosun.eul.MemoryWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1548,7 +1548,7 @@ CODE_SIGN_ENTITLEMENTS = MemoryWidget/MemoryWidget.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_TEAM = M8G2RFZVFV; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = MemoryWidget/Info.plist; @@ -1558,7 +1558,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.4.7; + MARKETING_VERSION = 1.4.8; PRODUCT_BUNDLE_IDENTIFIER = com.gaosun.eul.MemoryWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1574,7 +1574,7 @@ CODE_SIGN_ENTITLEMENTS = NetworkWidget/NetworkWidget.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_TEAM = M8G2RFZVFV; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = NetworkWidget/Info.plist; @@ -1584,7 +1584,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.4.7; + MARKETING_VERSION = 1.4.8; PRODUCT_BUNDLE_IDENTIFIER = com.gaosun.eul.NetworkWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1600,7 +1600,7 @@ CODE_SIGN_ENTITLEMENTS = NetworkWidget/NetworkWidget.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_TEAM = M8G2RFZVFV; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = NetworkWidget/Info.plist; @@ -1610,7 +1610,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.4.7; + MARKETING_VERSION = 1.4.8; PRODUCT_BUNDLE_IDENTIFIER = com.gaosun.eul.NetworkWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1745,7 +1745,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = M8G2RFZVFV; ENABLE_HARDENED_RUNTIME = YES; @@ -1757,7 +1757,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.4.7; + MARKETING_VERSION = 1.4.8; PRODUCT_BUNDLE_IDENTIFIER = com.gaosun.eul; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = ""; @@ -1776,7 +1776,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = M8G2RFZVFV; ENABLE_HARDENED_RUNTIME = YES; @@ -1788,7 +1788,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; - MARKETING_VERSION = 1.4.7; + MARKETING_VERSION = 1.4.8; PRODUCT_BUNDLE_IDENTIFIER = com.gaosun.eul; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = ""; @@ -1804,7 +1804,7 @@ CODE_SIGN_ENTITLEMENTS = BatteryWidget/BatteryWidget.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_TEAM = M8G2RFZVFV; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = BatteryWidget/Info.plist; @@ -1814,7 +1814,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.4.7; + MARKETING_VERSION = 1.4.8; PRODUCT_BUNDLE_IDENTIFIER = com.gaosun.eul.BatteryWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1830,7 +1830,7 @@ CODE_SIGN_ENTITLEMENTS = BatteryWidget/BatteryWidget.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_TEAM = M8G2RFZVFV; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = BatteryWidget/Info.plist; @@ -1840,7 +1840,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.4.7; + MARKETING_VERSION = 1.4.8; PRODUCT_BUNDLE_IDENTIFIER = com.gaosun.eul.BatteryWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1856,7 +1856,7 @@ CODE_SIGN_ENTITLEMENTS = CpuWidget/CpuWidget.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_TEAM = M8G2RFZVFV; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = CpuWidget/Info.plist; @@ -1866,7 +1866,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.4.7; + MARKETING_VERSION = 1.4.8; PRODUCT_BUNDLE_IDENTIFIER = com.gaosun.eul.CpuWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -1882,7 +1882,7 @@ CODE_SIGN_ENTITLEMENTS = CpuWidget/CpuWidget.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 27; DEVELOPMENT_TEAM = M8G2RFZVFV; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = CpuWidget/Info.plist; @@ -1892,7 +1892,7 @@ "@executable_path/../../../../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.4.7; + MARKETING_VERSION = 1.4.8; PRODUCT_BUNDLE_IDENTIFIER = com.gaosun.eul.CpuWidget; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; diff --git a/eul/Schema/FanData.swift b/eul/Schema/FanData.swift index 8ba8de88..55bf46c8 100644 --- a/eul/Schema/FanData.swift +++ b/eul/Schema/FanData.swift @@ -10,20 +10,27 @@ import Foundation import SharedLibrary import SwiftyJSON -class FanData: Identifiable { - let fan: Fan - var speed: Int +struct FanData: Identifiable { + let id: Int + var currentSpeed: Int? + var minSpeed: Int? + var maxSpeed: Int? - var id: Int { - fan.id + var currentSpeedString: String { + currentSpeed.map { + "\($0) rpm" + } ?? "N/A" } - var percentage: Double { - Double(speed) / Double(fan.maxSpeed) * 100 + var minSpeedString: String { + minSpeed.map { + "\($0) rpm" + } ?? "N/A" } - init(fan: Fan, speed: Int = 0) { - self.fan = fan - self.speed = speed + var maxSpeedString: String { + maxSpeed.map { + "\($0) rpm" + } ?? "N/A" } } diff --git a/eul/StatusBar/StatusBarItem.swift b/eul/StatusBar/StatusBarItem.swift index d941fd2b..9a52d07d 100644 --- a/eul/StatusBar/StatusBarItem.swift +++ b/eul/StatusBar/StatusBarItem.swift @@ -91,13 +91,14 @@ class StatusBarItem: NSObject, NSMenuDelegate { } } - override init() { + init(named: String = "eul") { config = getStatusBarConfig() statusBarMenu = NSMenu() item = NSStatusBar.system.statusItem(withLength: 0) super.init() statusBarMenu.delegate = self + item.autosaveName = named item.isVisible = false if let menuBuilder = config.menuBuilder { diff --git a/eul/Utilities/SmcControl.swift b/eul/Utilities/SmcControl.swift index b9bad431..8f7d9f66 100644 --- a/eul/Utilities/SmcControl.swift +++ b/eul/Utilities/SmcControl.swift @@ -40,13 +40,10 @@ class SmcControl: Refreshable { do { try SMCKit.open() sensors = try SMCKit.allKnownTemperatureSensors().map { .init(sensor: $0) } - fans = try (0..