feat: improved SMC helper service initialization

This commit is contained in:
Serhiy Mytrovtsiy
2023-04-15 21:20:32 +02:00
parent be6582ed8f
commit 7e4d36b569
3 changed files with 16 additions and 9 deletions

View File

@@ -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) {

View File

@@ -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

View File

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