From 7e4d36b569b96ad3a831179060d987e73007b24e Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Sat, 15 Apr 2023 21:20:32 +0200 Subject: [PATCH] feat: improved SMC helper service initialization --- Kit/helpers.swift | 19 +++++++++++++------ Modules/Disk/popup.swift | 4 ++-- Stats/Supporting Files/Info.plist | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Kit/helpers.swift b/Kit/helpers.swift index bffc3f0a..fb05a6bb 100644 --- a/Kit/helpers.swift +++ b/Kit/helpers.swift @@ -765,7 +765,7 @@ public class ProcessView: NSStackView { view.cell?.truncatesLastVisibleLine = true return view }() - private var valueView: ValueField = ValueField(frame: NSRect(x: 0, y: 0, width: 0, height: 0)) + private var valueView: ValueField = ValueField() public init(size: CGSize = CGSize(width: 264, height: 22)) { var rect = NSRect(x: 5, y: 5, width: 12, height: 12) @@ -1153,13 +1153,20 @@ public class SMCHelper { } private func helper(_ completion: ((Bool) -> Void)?) -> HelperProtocol? { - guard let helper = self.helperConnection()?.remoteObjectProxyWithErrorHandler({ _ in - if let onCompletion = completion { onCompletion(false) } - }) as? HelperProtocol else { return nil } + guard let helper = self.helperConnection() else { + completion?(false) + return nil + } + guard let service = helper.remoteObjectProxyWithErrorHandler({ error in + print(error) + }) as? HelperProtocol else { + completion?(false) + return nil + } - helper.setSMCPath(Bundle.main.path(forResource: "smc", ofType: nil)!) + service.setSMCPath(Bundle.main.path(forResource: "smc", ofType: nil)!) - return helper + return service } public func uninstall(silent: Bool = false) { diff --git a/Modules/Disk/popup.swift b/Modules/Disk/popup.swift index 82c6dcbe..c4782ea6 100644 --- a/Modules/Disk/popup.swift +++ b/Modules/Disk/popup.swift @@ -126,14 +126,14 @@ internal class Popup: PopupWrapper { let view = SettingsContainerView() view.addArrangedSubview(selectSettingsRow( - title: localizedString("Color of write"), + title: localizedString("Write color"), action: #selector(toggleWriteColor), items: Color.allColors, selected: self.writeColorState.key )) view.addArrangedSubview(selectSettingsRow( - title: localizedString("Color of read"), + title: localizedString("Read color"), action: #selector(toggleReadColor), items: Color.allColors, selected: self.readColorState.key diff --git a/Stats/Supporting Files/Info.plist b/Stats/Supporting Files/Info.plist index 2887ffbe..23d73a4b 100755 --- a/Stats/Supporting Files/Info.plist +++ b/Stats/Supporting Files/Info.plist @@ -17,7 +17,7 @@ CFBundleShortVersionString $(MARKETING_VERSION) CFBundleVersion - 469 + 471 Description Simple macOS system monitor in your menu bar LSApplicationCategoryType