mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
init Sensors module
This commit is contained in:
106
ModuleKit/Widgets/Sensors.swift
Normal file
106
ModuleKit/Widgets/Sensors.swift
Normal file
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// Sensors.swift
|
||||
// ModuleKit
|
||||
//
|
||||
// Created by Serhiy Mytrovtsiy on 17/06/2020.
|
||||
// Using Swift 5.0.
|
||||
// Running on macOS 10.15.
|
||||
//
|
||||
// Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import StatsKit
|
||||
|
||||
public class SensorsWidget: Widget {
|
||||
private var labelState: Bool = false
|
||||
private let store: UnsafePointer<Store>?
|
||||
|
||||
private var values: [String] = []
|
||||
|
||||
public init(preview: Bool, title: String, config: NSDictionary?, store: UnsafePointer<Store>?) {
|
||||
self.store = store
|
||||
if config != nil {
|
||||
var configuration = config!
|
||||
|
||||
if preview {
|
||||
if let previewConfig = config!["Preview"] as? NSDictionary {
|
||||
configuration = previewConfig
|
||||
if let value = configuration["Values"] as? String {
|
||||
self.values = value.split(separator: ",").map{ (String($0) ) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let label = configuration["Label"] as? Bool {
|
||||
self.labelState = label
|
||||
}
|
||||
}
|
||||
super.init(frame: CGRect(x: 0, y: Constants.Widget.margin, width: Constants.Widget.width, height: Constants.Widget.height - (2*Constants.Widget.margin)))
|
||||
self.title = title
|
||||
self.type = .sensors
|
||||
self.preview = preview
|
||||
self.canDrawConcurrently = true
|
||||
|
||||
if self.store != nil {
|
||||
self.labelState = store!.pointee.bool(key: "\(self.title)_\(self.type.rawValue)_label", defaultValue: self.labelState)
|
||||
}
|
||||
|
||||
if self.preview {
|
||||
self.labelState = false
|
||||
}
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
public override func draw(_ dirtyRect: NSRect) {
|
||||
super.draw(dirtyRect)
|
||||
guard self.values.count != 0 else {
|
||||
self.setWidth(1)
|
||||
return
|
||||
}
|
||||
|
||||
let num: Int = Int(round(Double(self.values.count) / 2))
|
||||
let width: CGFloat = Constants.Widget.width * CGFloat(num)
|
||||
|
||||
let rowWidth: CGFloat = Constants.Widget.width - (Constants.Widget.margin*2)
|
||||
let rowHeight: CGFloat = self.frame.height / 2
|
||||
|
||||
let style = NSMutableParagraphStyle()
|
||||
style.alignment = .right
|
||||
let attributes = [
|
||||
NSAttributedString.Key.font: NSFont.systemFont(ofSize: 9, weight: .light),
|
||||
NSAttributedString.Key.foregroundColor: NSColor.textColor,
|
||||
NSAttributedString.Key.paragraphStyle: style
|
||||
]
|
||||
|
||||
var x: CGFloat = Constants.Widget.margin
|
||||
for i in 0..<num {
|
||||
if self.values.indices.contains(i*2) {
|
||||
let rect = CGRect(x: x, y: 1, width: rowWidth, height: rowHeight)
|
||||
let str = NSAttributedString.init(string: self.values[i*2], attributes: attributes)
|
||||
str.draw(with: rect)
|
||||
}
|
||||
|
||||
if self.values.indices.contains((i*2)+1) {
|
||||
let rect = CGRect(x: x, y: rowHeight+1, width: rowWidth, height: rowHeight)
|
||||
let str = NSAttributedString.init(string: self.values[(i*2)+1], attributes: attributes)
|
||||
str.draw(with: rect)
|
||||
}
|
||||
|
||||
x += Constants.Widget.width
|
||||
}
|
||||
|
||||
self.setWidth(width)
|
||||
}
|
||||
|
||||
public func setValues(_ values: [String]) {
|
||||
self.values = values
|
||||
|
||||
DispatchQueue.main.async(execute: {
|
||||
self.display()
|
||||
})
|
||||
}
|
||||
}
|
||||
82
ModuleKit/Widgets/popup.swift
Normal file
82
ModuleKit/Widgets/popup.swift
Normal file
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// popup.swift
|
||||
// Stats
|
||||
//
|
||||
// Created by Serhiy Mytrovtsiy on 22/06/2020.
|
||||
// Using Swift 5.0.
|
||||
// Running on macOS 10.15.
|
||||
//
|
||||
// Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import ModuleKit
|
||||
import StatsKit
|
||||
|
||||
internal class Popup: NSView {
|
||||
private var list: [String: NSTextField] = [:]
|
||||
|
||||
public init() {
|
||||
super.init(frame: NSRect( x: 0, y: 0, width: Constants.Popup.width, height: 0))
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
internal func setup(_ values: [Sensor_t]?) {
|
||||
guard values != nil else {
|
||||
return
|
||||
}
|
||||
|
||||
var types: [SensorType_t: Int] = [:]
|
||||
values!.forEach { (s: Sensor_t) in
|
||||
types[s.type] = (types[s.type] ?? 0) + 1
|
||||
}
|
||||
|
||||
self.subviews.forEach { (v: NSView) in
|
||||
v.removeFromSuperview()
|
||||
}
|
||||
|
||||
var y: CGFloat = 0
|
||||
types.sorted{ $0.1 < $1.1 }.forEach { (t: (key: SensorType_t, value: Int)) in
|
||||
let filtered = values!.filter{ $0.type == t.key }
|
||||
var groups: [SensorGroup_t: Int] = [:]
|
||||
filtered.forEach { (s: Sensor_t) in
|
||||
groups[s.group] = (groups[s.group] ?? 0) + 1
|
||||
}
|
||||
|
||||
let height: CGFloat = CGFloat((22*filtered.count)) + Constants.Popup.separatorHeight
|
||||
|
||||
let view: NSView = NSView(frame: NSRect(x: 0, y: y, width: self.frame.width, height: height))
|
||||
let separator = SeparatorView(t.key, origin: NSPoint(x: 0, y: view.frame.height - Constants.Popup.separatorHeight), width: self.frame.width)
|
||||
view.addSubview(separator)
|
||||
|
||||
var i: CGFloat = 0
|
||||
groups.sorted{ $0.1 < $1.1 }.forEach { (g: (key: SensorGroup_t, value: Int)) in
|
||||
filtered.reversed().filter{ $0.group == g.key }.forEach { (s: Sensor_t) in
|
||||
print(s.name)
|
||||
self.list[s.key] = PopupRow(view, n: i, title: "\(s.name):", value: s.formattedValue)
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
|
||||
self.addSubview(view)
|
||||
y += height
|
||||
}
|
||||
|
||||
self.setFrameSize(NSSize(width: self.frame.width, height: y - Constants.Popup.margins))
|
||||
}
|
||||
|
||||
internal func usageCallback(_ values: [Sensor_t]) {
|
||||
values.forEach { (s: Sensor_t) in
|
||||
if self.list[s.key] != nil {
|
||||
DispatchQueue.main.async(execute: {
|
||||
if self.window!.isVisible {
|
||||
self.list[s.key]?.stringValue = s.formattedValue
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public enum widget_t: String {
|
||||
case barChart = "bar_chart"
|
||||
case network = "network"
|
||||
case battery = "battery"
|
||||
case sensors = "sensors"
|
||||
}
|
||||
extension widget_t: CaseIterable {}
|
||||
|
||||
@@ -90,6 +91,9 @@ func LoadWidget(_ type: widget_t, preview: Bool, title: String, config: NSDictio
|
||||
case .battery:
|
||||
widget = BatterykWidget(preview: preview, title: title, config: widgetConfig, store: store)
|
||||
break
|
||||
case .sensors:
|
||||
widget = SensorsWidget(preview: preview, title: title, config: widgetConfig, store: store)
|
||||
break
|
||||
default: break
|
||||
}
|
||||
|
||||
|
||||
@@ -62,8 +62,6 @@ internal class DiskView: NSView {
|
||||
|
||||
private var mainView: NSView
|
||||
|
||||
private var initialized: Bool = false
|
||||
|
||||
public init(_ frame: NSRect, name: String, size: Int64, free: Int64, path: URL?) {
|
||||
self.mainView = NSView(frame: NSRect(x: 5, y: 5, width: frame.width - 10, height: frame.height - 10))
|
||||
self.name = name
|
||||
@@ -141,10 +139,6 @@ internal class DiskView: NSView {
|
||||
|
||||
public func update(free: Int64) {
|
||||
DispatchQueue.main.async(execute: {
|
||||
if !self.window!.isVisible && self.initialized {
|
||||
return
|
||||
}
|
||||
|
||||
if self.legendField != nil {
|
||||
self.legendField?.stringValue = "Used \(Units(bytes: (self.size - free)).getReadableMemory()) from \(Units(bytes: self.size).getReadableMemory())"
|
||||
self.percentageField?.stringValue = "\(Int8((Double(self.size - free) / Double(self.size)) * 100))%"
|
||||
@@ -155,8 +149,6 @@ internal class DiskView: NSView {
|
||||
let width: CGFloat = ((self.mainView.frame.width - 2) * percentage) / 1
|
||||
self.usedBarSpace?.setFrameSize(NSSize(width: width, height: self.usedBarSpace!.frame.height))
|
||||
}
|
||||
|
||||
self.initialized = true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ internal class UsageReader: Reader<Usage> {
|
||||
}
|
||||
|
||||
self.reachability!.whenReachable = { _ in
|
||||
self.usage.reset()
|
||||
self.readInformation()
|
||||
}
|
||||
self.reachability!.whenUnreachable = { _ in
|
||||
|
||||
24
Modules/Sensors/Info.plist
Normal file
24
Modules/Sensors/Info.plist
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
23
Modules/Sensors/config.plist
Normal file
23
Modules/Sensors/config.plist
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Name</key>
|
||||
<string>Sensors</string>
|
||||
<key>State</key>
|
||||
<true/>
|
||||
<key>Widgets</key>
|
||||
<dict>
|
||||
<key>sensors</key>
|
||||
<dict>
|
||||
<key>Default</key>
|
||||
<true/>
|
||||
<key>Preview</key>
|
||||
<dict>
|
||||
<key>Values</key>
|
||||
<string>38°,41°</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
54
Modules/Sensors/main.swift
Normal file
54
Modules/Sensors/main.swift
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// main.swift
|
||||
// Stats
|
||||
//
|
||||
// Created by Serhiy Mytrovtsiy on 17/06/2020.
|
||||
// Using Swift 5.0.
|
||||
// Running on macOS 10.15.
|
||||
//
|
||||
// Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import ModuleKit
|
||||
import StatsKit
|
||||
|
||||
public class Sensors: Module {
|
||||
private var sensorsReader: SensorsReader
|
||||
private let popupView: Popup = Popup()
|
||||
|
||||
public init(_ store: UnsafePointer<Store>?, _ smc: UnsafePointer<SMCService>) {
|
||||
self.sensorsReader = SensorsReader(smc)
|
||||
super.init(
|
||||
store: store,
|
||||
popup: self.popupView,
|
||||
settings: nil
|
||||
)
|
||||
|
||||
self.popupView.setup(self.sensorsReader.list)
|
||||
|
||||
self.sensorsReader.readyCallback = { [unowned self] in
|
||||
self.readyHandler()
|
||||
}
|
||||
self.sensorsReader.callbackHandler = { [unowned self] value in
|
||||
self.usageCallback(value)
|
||||
}
|
||||
|
||||
self.addReader(self.sensorsReader)
|
||||
}
|
||||
|
||||
private func usageCallback(_ value: [Sensor_t]?) {
|
||||
if value == nil {
|
||||
return
|
||||
}
|
||||
|
||||
self.popupView.usageCallback(value!)
|
||||
|
||||
let value_1 = value?.first{ $0.key == "TC0F" }
|
||||
let value_2 = value?.first{ $0.key == "TC0P" }
|
||||
|
||||
if let widget = self.widget as? SensorsWidget {
|
||||
widget.setValues([value_1!.formattedMiniValue, value_2!.formattedMiniValue])
|
||||
}
|
||||
}
|
||||
}
|
||||
54
Modules/Sensors/readers.swift
Normal file
54
Modules/Sensors/readers.swift
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// readers.swift
|
||||
// Stats
|
||||
//
|
||||
// Created by Serhiy Mytrovtsiy on 17/06/2020.
|
||||
// Using Swift 5.0.
|
||||
// Running on macOS 10.15.
|
||||
//
|
||||
// Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import ModuleKit
|
||||
import StatsKit
|
||||
|
||||
internal class SensorsReader: Reader<[Sensor_t]> {
|
||||
internal var list: [Sensor_t] = []
|
||||
private var smc: UnsafePointer<SMCService>
|
||||
|
||||
init(_ smc: UnsafePointer<SMCService>) {
|
||||
self.smc = smc
|
||||
}
|
||||
|
||||
public override func setup() {
|
||||
var available: [String] = self.smc.pointee.getAllKeys()
|
||||
|
||||
available = available.filter({ (key: String) -> Bool in
|
||||
switch key.prefix(1) {
|
||||
case "T", "V", "P": return SensorsDict[key] != nil
|
||||
default: return false
|
||||
}
|
||||
})
|
||||
|
||||
available.forEach { (key: String) in
|
||||
if var sensor = SensorsDict[key] {
|
||||
sensor.value = self.smc.pointee.getValue(key)
|
||||
if sensor.value != nil {
|
||||
sensor.key = key
|
||||
self.list.append(sensor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override func read() {
|
||||
for i in 0..<self.list.count {
|
||||
if let newValue = self.smc.pointee.getValue(self.list[i].key) {
|
||||
// print(self.list[i].type, measurement.unit)
|
||||
self.list[i].value = newValue
|
||||
}
|
||||
}
|
||||
self.callback(self.list)
|
||||
}
|
||||
}
|
||||
187
Modules/Sensors/values.swift
Normal file
187
Modules/Sensors/values.swift
Normal file
@@ -0,0 +1,187 @@
|
||||
//
|
||||
// values.swift
|
||||
// Stats
|
||||
//
|
||||
// Created by Serhiy Mytrovtsiy on 17/06/2020.
|
||||
// Using Swift 5.0.
|
||||
// Running on macOS 10.15.
|
||||
//
|
||||
// Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.
|
||||
//
|
||||
|
||||
import StatsKit
|
||||
|
||||
typealias SensorGroup_t = String
|
||||
enum SensorGroup: SensorGroup_t {
|
||||
case CPU = "CPU"
|
||||
case GPU = "GPU"
|
||||
case System = "Systems"
|
||||
case Sensor = "Sensors"
|
||||
}
|
||||
|
||||
typealias SensorType_t = String
|
||||
enum SensorType: SensorType_t {
|
||||
case Temperature = "Temperature"
|
||||
case Voltage = "Voltage"
|
||||
case Power = "Power"
|
||||
case Frequency = "Frequency"
|
||||
case Battery = "Battery"
|
||||
}
|
||||
|
||||
struct Sensor_t {
|
||||
var name: String
|
||||
var key: String = ""
|
||||
|
||||
var group: SensorGroup_t
|
||||
var type: SensorType_t
|
||||
var unit: String {
|
||||
get {
|
||||
switch self.type {
|
||||
case SensorType.Temperature.rawValue:
|
||||
return "°C"
|
||||
case SensorType.Voltage.rawValue:
|
||||
return "V"
|
||||
case SensorType.Power.rawValue:
|
||||
return "W"
|
||||
default: return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var value: Double? = nil
|
||||
|
||||
var formattedValue: String {
|
||||
get {
|
||||
switch self.type {
|
||||
case SensorType.Temperature.rawValue:
|
||||
return MeasurementFormatter().string(from: (value ?? 0).localizeTemperature())
|
||||
case SensorType.Voltage.rawValue:
|
||||
return String(format: "%.3f \(unit)", value ?? 0)
|
||||
case SensorType.Power.rawValue:
|
||||
return String(format: "%.2f \(unit)", value ?? 0)
|
||||
default: return String(format: "%.2f", value ?? 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
var formattedMiniValue: String {
|
||||
get {
|
||||
switch self.type {
|
||||
case SensorType.Temperature.rawValue:
|
||||
return String(format: "%.0f°", value?.localizeTemperature().value ?? 0)
|
||||
case SensorType.Voltage.rawValue:
|
||||
return String(format: "%.1f\(unit)", value ?? 0)
|
||||
case SensorType.Power.rawValue:
|
||||
return String(format: "%.1f\(unit)", value ?? 0)
|
||||
default: return String(format: "%.1f", value ?? 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// List of keys: https://github.com/acidanthera/VirtualSMC/blob/master/Docs/SMCSensorKeys.txt
|
||||
let SensorsDict: [String: Sensor_t] = [
|
||||
/// Temperature
|
||||
"TA0P": Sensor_t(name: "Ambient 1", group: SensorGroup.Sensor.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TA1P": Sensor_t(name: "Ambient 2", group: SensorGroup.Sensor.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"Th0H": Sensor_t(name: "Heatpipe 1", group: SensorGroup.Sensor.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"Th1H": Sensor_t(name: "Heatpipe 2", group: SensorGroup.Sensor.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"Th2H": Sensor_t(name: "Heatpipe 3", group: SensorGroup.Sensor.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"Th3H": Sensor_t(name: "Heatpipe 4", group: SensorGroup.Sensor.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TZ0C": Sensor_t(name: "Termal zone 1", group: SensorGroup.Sensor.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TZ1C": Sensor_t(name: "Termal zone 2", group: SensorGroup.Sensor.rawValue, type: SensorType.Temperature.rawValue),
|
||||
|
||||
"TC0E": Sensor_t(name: "CPU 1", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC0F": Sensor_t(name: "CPU 2", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC0D": Sensor_t(name: "CPU die", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC0C": Sensor_t(name: "CPU core", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC0H": Sensor_t(name: "CPU heatsink", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC0P": Sensor_t(name: "CPU proximity", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TCAD": Sensor_t(name: "CPU package", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
|
||||
"TC1C": Sensor_t(name: "CPU core 1", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC2C": Sensor_t(name: "CPU core 2", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC3C": Sensor_t(name: "CPU core 3", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC4C": Sensor_t(name: "CPU core 4", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC5C": Sensor_t(name: "CPU core 5", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC6C": Sensor_t(name: "CPU core 6", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC7C": Sensor_t(name: "CPU core 7", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TC8C": Sensor_t(name: "CPU core 8", group: SensorGroup.CPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
|
||||
"TCGC": Sensor_t(name: "GPU Intel Graphics", group: SensorGroup.GPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TG0D": Sensor_t(name: "GPU die", group: SensorGroup.GPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TG0H": Sensor_t(name: "GPU heatsink", group: SensorGroup.GPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TG0P": Sensor_t(name: "GPU proximity", group: SensorGroup.GPU.rawValue, type: SensorType.Temperature.rawValue),
|
||||
|
||||
"Tm0P": Sensor_t(name: "Mainboard", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"Tp0P": Sensor_t(name: "Powerboard", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TB1T": Sensor_t(name: "Battery", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TW0P": Sensor_t(name: "Airport", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TL0P": Sensor_t(name: "Display", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TI0P": Sensor_t(name: "Thunderbold 1", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TI1P": Sensor_t(name: "Thunderbold 2", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TI2P": Sensor_t(name: "Thunderbold 3", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TI3P": Sensor_t(name: "Thunderbold 4", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
|
||||
"TN0D": Sensor_t(name: "Northbridge die", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TN0H": Sensor_t(name: "Northbridge heatsink", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
"TN0P": Sensor_t(name: "Northbridge proximity", group: SensorGroup.System.rawValue, type: SensorType.Temperature.rawValue),
|
||||
|
||||
/// Voltage
|
||||
"VCAC": Sensor_t(name: "CPU IA", group: SensorGroup.CPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VCSC": Sensor_t(name: "CPU System Agent", group: SensorGroup.CPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VC0C": Sensor_t(name: "CPU Core 1", group: SensorGroup.CPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VC1C": Sensor_t(name: "CPU Core 2", group: SensorGroup.CPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VC2C": Sensor_t(name: "CPU Core 3", group: SensorGroup.CPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VC3C": Sensor_t(name: "CPU Core 4", group: SensorGroup.CPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VC4C": Sensor_t(name: "CPU Core 5", group: SensorGroup.CPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VC5C": Sensor_t(name: "CPU Core 6", group: SensorGroup.CPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VC6C": Sensor_t(name: "CPU Core 7", group: SensorGroup.CPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VC7C": Sensor_t(name: "CPU Core 8", group: SensorGroup.CPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
|
||||
"VCTC": Sensor_t(name: "GPU Intel Graphics", group: SensorGroup.GPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VG0C": Sensor_t(name: "GPU", group: SensorGroup.GPU.rawValue, type: SensorType.Voltage.rawValue),
|
||||
|
||||
"VM0R": Sensor_t(name: "Memory", group: SensorGroup.System.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"Vb0R": Sensor_t(name: "CMOS", group: SensorGroup.System.rawValue, type: SensorType.Voltage.rawValue),
|
||||
|
||||
"VD0R": Sensor_t(name: "DC In", group: SensorGroup.Sensor.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VP0R": Sensor_t(name: "12V rail", group: SensorGroup.Sensor.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"Vp0C": Sensor_t(name: "12V vcc", group: SensorGroup.Sensor.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VV2S": Sensor_t(name: "3V", group: SensorGroup.Sensor.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VR3R": Sensor_t(name: "3.3V", group: SensorGroup.Sensor.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VV1S": Sensor_t(name: "5V", group: SensorGroup.Sensor.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VV9S": Sensor_t(name: "12V", group: SensorGroup.Sensor.rawValue, type: SensorType.Voltage.rawValue),
|
||||
"VeES": Sensor_t(name: "PCI 12V", group: SensorGroup.Sensor.rawValue, type: SensorType.Voltage.rawValue),
|
||||
|
||||
/// Power
|
||||
"PC0C": Sensor_t(name: "CPU Core", group: SensorGroup.CPU.rawValue, type: SensorType.Power.rawValue),
|
||||
"PCPC": Sensor_t(name: "CPU Package", group: SensorGroup.CPU.rawValue, type: SensorType.Power.rawValue),
|
||||
"PCPT": Sensor_t(name: "CPU Package total", group: SensorGroup.CPU.rawValue, type: SensorType.Power.rawValue),
|
||||
"PC0R": Sensor_t(name: "CPU Computing high side", group: SensorGroup.CPU.rawValue, type: SensorType.Power.rawValue),
|
||||
"PC0G": Sensor_t(name: "CPU GFX", group: SensorGroup.CPU.rawValue, type: SensorType.Power.rawValue),
|
||||
|
||||
"PCPG": Sensor_t(name: "GPU Intel Graphics", group: SensorGroup.GPU.rawValue, type: SensorType.Power.rawValue),
|
||||
"PG0R": Sensor_t(name: "GPU", group: SensorGroup.GPU.rawValue, type: SensorType.Power.rawValue),
|
||||
|
||||
"PPBR": Sensor_t(name: "Battery", group: SensorGroup.Sensor.rawValue, type: SensorType.Power.rawValue),
|
||||
"PDTR": Sensor_t(name: "DC In", group: SensorGroup.Sensor.rawValue, type: SensorType.Power.rawValue),
|
||||
"PSTR": Sensor_t(name: "System total", group: SensorGroup.Sensor.rawValue, type: SensorType.Power.rawValue),
|
||||
|
||||
/// Frequency
|
||||
"FRC0": Sensor_t(name: "CPU 1", group: SensorGroup.CPU.rawValue, type: SensorType.Frequency.rawValue),
|
||||
"FRC1": Sensor_t(name: "CPU 2", group: SensorGroup.CPU.rawValue, type: SensorType.Frequency.rawValue),
|
||||
"FRC2": Sensor_t(name: "CPU 3", group: SensorGroup.CPU.rawValue, type: SensorType.Frequency.rawValue),
|
||||
"FRC3": Sensor_t(name: "CPU 4", group: SensorGroup.CPU.rawValue, type: SensorType.Frequency.rawValue),
|
||||
"FRC4": Sensor_t(name: "CPU 5", group: SensorGroup.CPU.rawValue, type: SensorType.Frequency.rawValue),
|
||||
"FRC5": Sensor_t(name: "CPU 6", group: SensorGroup.CPU.rawValue, type: SensorType.Frequency.rawValue),
|
||||
"FRC6": Sensor_t(name: "CPU 7", group: SensorGroup.CPU.rawValue, type: SensorType.Frequency.rawValue),
|
||||
"FRC7": Sensor_t(name: "CPU 8", group: SensorGroup.CPU.rawValue, type: SensorType.Frequency.rawValue),
|
||||
|
||||
"CG0C": Sensor_t(name: "GPU", group: SensorGroup.GPU.rawValue, type: SensorType.Frequency.rawValue),
|
||||
"CG0S": Sensor_t(name: "GPU shader", group: SensorGroup.GPU.rawValue, type: SensorType.Frequency.rawValue),
|
||||
"CG0M": Sensor_t(name: "GPU memory", group: SensorGroup.GPU.rawValue, type: SensorType.Frequency.rawValue),
|
||||
|
||||
/// Battery
|
||||
"B0AV": Sensor_t(name: "Voltage", group: SensorGroup.Sensor.rawValue, type: SensorType.Battery.rawValue),
|
||||
"B0AC": Sensor_t(name: "Amperage", group: SensorGroup.Sensor.rawValue, type: SensorType.Battery.rawValue),
|
||||
]
|
||||
@@ -18,6 +18,8 @@
|
||||
9A0C82EB24460FB100FAE3D4 /* StatsKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9A0C82DA24460F7200FAE3D4 /* StatsKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
9A0C82EE2446124800FAE3D4 /* SystemKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A7D0CB62444C2C800B09070 /* SystemKit.swift */; };
|
||||
9A1A7ABA24561F0B00A84F7A /* BarChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A1A7AB924561F0B00A84F7A /* BarChart.swift */; };
|
||||
9A2DD8CC24A1190A00F6F48D /* popup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2DD8CB24A1190A00F6F48D /* popup.swift */; };
|
||||
9A2DD8CD24A1193500F6F48D /* popup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A2DD8CB24A1190A00F6F48D /* popup.swift */; };
|
||||
9A313BF7247EF01800DB5101 /* Reachability.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A5349CD23D8832E00C23824 /* Reachability.framework */; };
|
||||
9A313BF8247EF01800DB5101 /* Reachability.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9A5349CD23D8832E00C23824 /* Reachability.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
9A34353B243E278D006B19F9 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A34353A243E278D006B19F9 /* main.swift */; };
|
||||
@@ -91,6 +93,21 @@
|
||||
9ABFF910248BEE7200C9041A /* readers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ABFF90F248BEE7200C9041A /* readers.swift */; };
|
||||
9ABFF912248BF39500C9041A /* Battery.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ABFF911248BF39500C9041A /* Battery.swift */; };
|
||||
9ABFF914248C30A800C9041A /* popup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9ABFF913248C30A800C9041A /* popup.swift */; };
|
||||
9AE29ADC249A50350071B02D /* Sensors.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AE29AD5249A50350071B02D /* Sensors.framework */; };
|
||||
9AE29ADD249A50350071B02D /* Sensors.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9AE29AD5249A50350071B02D /* Sensors.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
9AE29AE1249A50640071B02D /* ModuleKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AABEADD243FB13500668CB0 /* ModuleKit.framework */; };
|
||||
9AE29AE2249A50640071B02D /* ModuleKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9AABEADD243FB13500668CB0 /* ModuleKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
9AE29AE5249A50640071B02D /* StatsKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A0C82DA24460F7200FAE3D4 /* StatsKit.framework */; };
|
||||
9AE29AE6249A50640071B02D /* StatsKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9A0C82DA24460F7200FAE3D4 /* StatsKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
9AE29AEE249A50960071B02D /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9AE29AEC249A50960071B02D /* Info.plist */; };
|
||||
9AE29AF3249A51D70071B02D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AE29AF1249A50CD0071B02D /* main.swift */; };
|
||||
9AE29AF5249A52870071B02D /* config.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9AE29AF4249A52870071B02D /* config.plist */; };
|
||||
9AE29AF6249A52B00071B02D /* config.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9AE29AF4249A52870071B02D /* config.plist */; };
|
||||
9AE29AF8249A53420071B02D /* values.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AE29AF7249A53420071B02D /* values.swift */; };
|
||||
9AE29AFA249A53780071B02D /* readers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AE29AF9249A53780071B02D /* readers.swift */; };
|
||||
9AE29AFB249A53DC0071B02D /* readers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AE29AF9249A53780071B02D /* readers.swift */; };
|
||||
9AE29AFC249A53DC0071B02D /* values.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AE29AF7249A53420071B02D /* values.swift */; };
|
||||
9AE29AFE249A82B70071B02D /* Sensors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AE29AFD249A82B70071B02D /* Sensors.swift */; };
|
||||
9AF9EE0924648751005D2270 /* Disk.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AF9EE0224648751005D2270 /* Disk.framework */; };
|
||||
9AF9EE0A24648751005D2270 /* Disk.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9AF9EE0224648751005D2270 /* Disk.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
9AF9EE0F2464875F005D2270 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AF9EE0E2464875F005D2270 /* main.swift */; };
|
||||
@@ -212,6 +229,27 @@
|
||||
remoteGlobalIDString = 9A0C82D924460F7200FAE3D4;
|
||||
remoteInfo = StatsKit;
|
||||
};
|
||||
9AE29ADA249A50350071B02D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9A1410ED229E721100D29793 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 9AE29AD4249A50350071B02D;
|
||||
remoteInfo = Sensors;
|
||||
};
|
||||
9AE29AE3249A50640071B02D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9A1410ED229E721100D29793 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 9AABEADC243FB13500668CB0;
|
||||
remoteInfo = ModuleKit;
|
||||
};
|
||||
9AE29AE7249A50640071B02D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9A1410ED229E721100D29793 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 9A0C82D924460F7200FAE3D4;
|
||||
remoteInfo = StatsKit;
|
||||
};
|
||||
9AF9EE0724648751005D2270 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 9A1410ED229E721100D29793 /* Project object */;
|
||||
@@ -262,6 +300,7 @@
|
||||
files = (
|
||||
9AF9EE0A24648751005D2270 /* Disk.framework in Embed Frameworks */,
|
||||
9A81C75E2449A41400825D92 /* Memory.framework in Embed Frameworks */,
|
||||
9AE29ADD249A50350071B02D /* Sensors.framework in Embed Frameworks */,
|
||||
9ABFF8FE248BEBCB00C9041A /* Battery.framework in Embed Frameworks */,
|
||||
9AABEB6C243FCE8A00668CB0 /* CPU.framework in Embed Frameworks */,
|
||||
9AABEAE5243FB13500668CB0 /* ModuleKit.framework in Embed Frameworks */,
|
||||
@@ -318,6 +357,18 @@
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9AE29AE9249A50640071B02D /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
9AE29AE2249A50640071B02D /* ModuleKit.framework in Embed Frameworks */,
|
||||
9AE29AE6249A50640071B02D /* StatsKit.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9AF9EE1824649BAD005D2270 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -341,6 +392,7 @@
|
||||
9A1410F5229E721100D29793 /* Stats.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Stats.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A141101229E721200D29793 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
9A1A7AB924561F0B00A84F7A /* BarChart.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BarChart.swift; sourceTree = "<group>"; };
|
||||
9A2DD8CB24A1190A00F6F48D /* popup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = popup.swift; path = ModuleKit/Widgets/popup.swift; sourceTree = SOURCE_ROOT; };
|
||||
9A343527243E26A0006B19F9 /* LaunchAtLogin.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LaunchAtLogin.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9A343535243E26A0006B19F9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
9A343536243E26A0006B19F9 /* LaunchAtLogin.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = LaunchAtLogin.entitlements; sourceTree = "<group>"; };
|
||||
@@ -398,6 +450,13 @@
|
||||
9ABFF90F248BEE7200C9041A /* readers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = readers.swift; sourceTree = "<group>"; };
|
||||
9ABFF911248BF39500C9041A /* Battery.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Battery.swift; sourceTree = "<group>"; };
|
||||
9ABFF913248C30A800C9041A /* popup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = popup.swift; sourceTree = "<group>"; };
|
||||
9AE29AD5249A50350071B02D /* Sensors.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Sensors.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9AE29AEC249A50960071B02D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = Info.plist; path = Modules/Sensors/Info.plist; sourceTree = SOURCE_ROOT; };
|
||||
9AE29AF1249A50CD0071B02D /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = main.swift; path = Modules/Sensors/main.swift; sourceTree = SOURCE_ROOT; };
|
||||
9AE29AF4249A52870071B02D /* config.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = config.plist; path = Modules/Sensors/config.plist; sourceTree = SOURCE_ROOT; };
|
||||
9AE29AF7249A53420071B02D /* values.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = values.swift; path = Modules/Sensors/values.swift; sourceTree = SOURCE_ROOT; };
|
||||
9AE29AF9249A53780071B02D /* readers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = readers.swift; path = Modules/Sensors/readers.swift; sourceTree = SOURCE_ROOT; };
|
||||
9AE29AFD249A82B70071B02D /* Sensors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sensors.swift; sourceTree = "<group>"; };
|
||||
9AF9EE0224648751005D2270 /* Disk.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Disk.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
9AF9EE0524648751005D2270 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
9AF9EE0E2464875F005D2270 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
@@ -421,6 +480,7 @@
|
||||
files = (
|
||||
9AF9EE0924648751005D2270 /* Disk.framework in Frameworks */,
|
||||
9AABEAE4243FB13500668CB0 /* ModuleKit.framework in Frameworks */,
|
||||
9AE29ADC249A50350071B02D /* Sensors.framework in Frameworks */,
|
||||
9ABFF8FD248BEBCB00C9041A /* Battery.framework in Frameworks */,
|
||||
9A81C75D2449A41400825D92 /* Memory.framework in Frameworks */,
|
||||
9A0C82E124460F7200FAE3D4 /* StatsKit.framework in Frameworks */,
|
||||
@@ -482,6 +542,15 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9AE29AD2249A50350071B02D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9AE29AE1249A50640071B02D /* ModuleKit.framework in Frameworks */,
|
||||
9AE29AE5249A50640071B02D /* StatsKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9AF9EDFF24648751005D2270 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -535,6 +604,7 @@
|
||||
9AF9EE0224648751005D2270 /* Disk.framework */,
|
||||
9A3E17CC247A94AF00449CD1 /* Net.framework */,
|
||||
9ABFF8F6248BEBCB00C9041A /* Battery.framework */,
|
||||
9AE29AD5249A50350071B02D /* Sensors.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -589,6 +659,7 @@
|
||||
9A1A7AB924561F0B00A84F7A /* BarChart.swift */,
|
||||
9A3E17E7247AA8E100449CD1 /* Network.swift */,
|
||||
9ABFF911248BF39500C9041A /* Battery.swift */,
|
||||
9AE29AFD249A82B70071B02D /* Sensors.swift */,
|
||||
);
|
||||
path = Widgets;
|
||||
sourceTree = "<group>";
|
||||
@@ -671,6 +742,7 @@
|
||||
9AF9EE0324648751005D2270 /* Disk */,
|
||||
9A3E17CD247A94AF00449CD1 /* Net */,
|
||||
9ABFF8F7248BEBCB00C9041A /* Battery */,
|
||||
9AE29AD6249A50350071B02D /* Sensors */,
|
||||
);
|
||||
path = Modules;
|
||||
sourceTree = "<group>";
|
||||
@@ -687,6 +759,20 @@
|
||||
path = Battery;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9AE29AD6249A50350071B02D /* Sensors */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9AE29AF1249A50CD0071B02D /* main.swift */,
|
||||
9AE29AF9249A53780071B02D /* readers.swift */,
|
||||
9A2DD8CB24A1190A00F6F48D /* popup.swift */,
|
||||
9AE29AF7249A53420071B02D /* values.swift */,
|
||||
9AE29AEC249A50960071B02D /* Info.plist */,
|
||||
9AE29AF4249A52870071B02D /* config.plist */,
|
||||
);
|
||||
name = Sensors;
|
||||
path = ../Sensors;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9AF9EE0324648751005D2270 /* Disk */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -746,6 +832,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9AE29AD0249A50350071B02D /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9AF9EDFD24648751005D2270 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -794,6 +887,7 @@
|
||||
9AF9EE0824648751005D2270 /* PBXTargetDependency */,
|
||||
9A3E17D2247A94AF00449CD1 /* PBXTargetDependency */,
|
||||
9ABFF8FC248BEBCB00C9041A /* PBXTargetDependency */,
|
||||
9AE29ADB249A50350071B02D /* PBXTargetDependency */,
|
||||
);
|
||||
name = Stats;
|
||||
productName = "Mini Stats";
|
||||
@@ -921,6 +1015,27 @@
|
||||
productReference = 9ABFF8F6248BEBCB00C9041A /* Battery.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
9AE29AD4249A50350071B02D /* Sensors */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 9AE29ADE249A50350071B02D /* Build configuration list for PBXNativeTarget "Sensors" */;
|
||||
buildPhases = (
|
||||
9AE29AD0249A50350071B02D /* Headers */,
|
||||
9AE29AD1249A50350071B02D /* Sources */,
|
||||
9AE29AD2249A50350071B02D /* Frameworks */,
|
||||
9AE29AD3249A50350071B02D /* Resources */,
|
||||
9AE29AE9249A50640071B02D /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
9AE29AE4249A50640071B02D /* PBXTargetDependency */,
|
||||
9AE29AE8249A50640071B02D /* PBXTargetDependency */,
|
||||
);
|
||||
name = Sensors;
|
||||
productName = Sensors;
|
||||
productReference = 9AE29AD5249A50350071B02D /* Sensors.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
9AF9EE0124648751005D2270 /* Disk */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 9AF9EE0D24648751005D2270 /* Build configuration list for PBXNativeTarget "Disk" */;
|
||||
@@ -951,7 +1066,7 @@
|
||||
KnownAssetTags = (
|
||||
New,
|
||||
);
|
||||
LastSwiftUpdateCheck = 1140;
|
||||
LastSwiftUpdateCheck = 1150;
|
||||
LastUpgradeCheck = 1150;
|
||||
ORGANIZATIONNAME = "Serhiy Mytrovtsiy";
|
||||
TargetAttributes = {
|
||||
@@ -994,6 +1109,9 @@
|
||||
CreatedOnToolsVersion = 11.5;
|
||||
LastSwiftMigration = 1150;
|
||||
};
|
||||
9AE29AD4249A50350071B02D = {
|
||||
CreatedOnToolsVersion = 11.5;
|
||||
};
|
||||
9AF9EE0124648751005D2270 = {
|
||||
CreatedOnToolsVersion = 11.4.1;
|
||||
LastSwiftMigration = 1140;
|
||||
@@ -1022,6 +1140,7 @@
|
||||
9AF9EE0124648751005D2270 /* Disk */,
|
||||
9A3E17CB247A94AF00449CD1 /* Net */,
|
||||
9ABFF8F5248BEBCB00C9041A /* Battery */,
|
||||
9AE29AD4249A50350071B02D /* Sensors */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -1038,7 +1157,9 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9AE29AEE249A50960071B02D /* Info.plist in Resources */,
|
||||
9A6CFC0122A1C9F5001E782D /* Assets.xcassets in Resources */,
|
||||
9AE29AF5249A52870071B02D /* config.plist in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -1089,6 +1210,14 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9AE29AD3249A50350071B02D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9AE29AF6249A52B00071B02D /* config.plist in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9AF9EE0024648751005D2270 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -1120,9 +1249,12 @@
|
||||
files = (
|
||||
9AABEB7E243FDEF100668CB0 /* main.swift in Sources */,
|
||||
9AABEB7A243FD26200668CB0 /* AppDelegate.swift in Sources */,
|
||||
9A2DD8CC24A1190A00F6F48D /* popup.swift in Sources */,
|
||||
9AE29AFA249A53780071B02D /* readers.swift in Sources */,
|
||||
9A9EA9452476D34500E3B883 /* Update.swift in Sources */,
|
||||
9A81C74E24499C7000825D92 /* Settings.swift in Sources */,
|
||||
9A81C74D24499C7000825D92 /* AppSettings.swift in Sources */,
|
||||
9AE29AF8249A53420071B02D /* values.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -1163,6 +1295,7 @@
|
||||
9A1A7ABA24561F0B00A84F7A /* BarChart.swift in Sources */,
|
||||
9A944D55244920690058F32A /* reader.swift in Sources */,
|
||||
9A7C61B42440DF810032695D /* Mini.swift in Sources */,
|
||||
9AE29AFE249A82B70071B02D /* Sensors.swift in Sources */,
|
||||
9A944D5D24492A8B0058F32A /* popup.swift in Sources */,
|
||||
9ABFF912248BF39500C9041A /* Battery.swift in Sources */,
|
||||
9AABEAEA243FB15E00668CB0 /* module.swift in Sources */,
|
||||
@@ -1193,6 +1326,17 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9AE29AD1249A50350071B02D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9A2DD8CD24A1193500F6F48D /* popup.swift in Sources */,
|
||||
9AE29AFB249A53DC0071B02D /* readers.swift in Sources */,
|
||||
9AE29AFC249A53DC0071B02D /* values.swift in Sources */,
|
||||
9AE29AF3249A51D70071B02D /* main.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
9AF9EDFE24648751005D2270 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -1287,6 +1431,21 @@
|
||||
target = 9A0C82D924460F7200FAE3D4 /* StatsKit */;
|
||||
targetProxy = 9ABFF90D248BEC2900C9041A /* PBXContainerItemProxy */;
|
||||
};
|
||||
9AE29ADB249A50350071B02D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 9AE29AD4249A50350071B02D /* Sensors */;
|
||||
targetProxy = 9AE29ADA249A50350071B02D /* PBXContainerItemProxy */;
|
||||
};
|
||||
9AE29AE4249A50640071B02D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 9AABEADC243FB13500668CB0 /* ModuleKit */;
|
||||
targetProxy = 9AE29AE3249A50640071B02D /* PBXContainerItemProxy */;
|
||||
};
|
||||
9AE29AE8249A50640071B02D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 9A0C82D924460F7200FAE3D4 /* StatsKit */;
|
||||
targetProxy = 9AE29AE7249A50640071B02D /* PBXContainerItemProxy */;
|
||||
};
|
||||
9AF9EE0824648751005D2270 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 9AF9EE0124648751005D2270 /* Disk */;
|
||||
@@ -1943,6 +2102,64 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
9AE29ADF249A50350071B02D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = RP2S87B72W;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = Modules/Sensors/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats.Sensors;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
9AE29AE0249A50350071B02D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = RP2S87B72W;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = Modules/Sensors/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats.Sensors;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
9AF9EE0B24648751005D2270 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -2090,6 +2307,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
9AE29ADE249A50350071B02D /* Build configuration list for PBXNativeTarget "Sensors" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
9AE29ADF249A50350071B02D /* Debug */,
|
||||
9AE29AE0249A50350071B02D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
9AF9EE0D24648751005D2270 /* Build configuration list for PBXNativeTarget "Disk" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
||||
@@ -15,12 +15,13 @@ import Memory
|
||||
import Disk
|
||||
import Net
|
||||
import Battery
|
||||
import Sensors
|
||||
|
||||
var store: Store = Store()
|
||||
let updater = macAppUpdater(user: "exelban", repo: "stats")
|
||||
let systemKit: SystemKit = SystemKit()
|
||||
var smc: SMCService = SMCService()
|
||||
var modules: [Module] = [Battery(&store), Network(&store), Disk(&store), Memory(&store), CPU(&store, &smc)].reversed()
|
||||
var modules: [Module] = [Battery(&store), Network(&store), Sensors(&store, &smc), Disk(&store), Memory(&store), CPU(&store, &smc)].reversed()
|
||||
var log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "Stats")
|
||||
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
@@ -13,8 +13,16 @@ import IOKit
|
||||
|
||||
enum SMCDataType: String {
|
||||
case UI32 = "ui32"
|
||||
case SP1E = "sp1e"
|
||||
case SP3C = "sp3c"
|
||||
case SP4B = "sp5b"
|
||||
case SP5A = "sp5a"
|
||||
case SP69 = "sp669"
|
||||
case SP78 = "sp78"
|
||||
case SP87 = "sp87"
|
||||
case SP96 = "sp96"
|
||||
case SPB4 = "spb4"
|
||||
case SPF0 = "spf0"
|
||||
case FLT = "flt "
|
||||
case FPE2 = "fpe2"
|
||||
case FP2E = "fp2e"
|
||||
@@ -140,9 +148,36 @@ public class SMCService {
|
||||
switch val.dataType {
|
||||
case SMCDataType.UI32.rawValue:
|
||||
return Double(UInt32(bytes: (val.bytes[0], val.bytes[1], val.bytes[2], val.bytes[3])))
|
||||
case SMCDataType.SP78.rawValue, SMCDataType.SP87.rawValue:
|
||||
case SMCDataType.SP1E.rawValue:
|
||||
let result: Double = Double(UInt16(val.bytes[0]) * 256 + UInt16(val.bytes[1]))
|
||||
return Double(result / 16384)
|
||||
case SMCDataType.SP3C.rawValue:
|
||||
let result: Double = Double(UInt16(val.bytes[0]) * 256 + UInt16(val.bytes[1]))
|
||||
return Double(result / 4096)
|
||||
case SMCDataType.SP4B.rawValue:
|
||||
let result: Double = Double(UInt16(val.bytes[0]) * 256 + UInt16(val.bytes[1]))
|
||||
return Double(result / 2048)
|
||||
case SMCDataType.SP5A.rawValue:
|
||||
let result: Double = Double(UInt16(val.bytes[0]) * 256 + UInt16(val.bytes[1]))
|
||||
return Double(result / 1024)
|
||||
case SMCDataType.SP69.rawValue:
|
||||
let result: Double = Double(UInt16(val.bytes[0]) * 256 + UInt16(val.bytes[1]))
|
||||
return Double(result / 512)
|
||||
case SMCDataType.SP78.rawValue:
|
||||
let intValue: Double = Double(Int(val.bytes[0]) * 256 + Int(val.bytes[1]))
|
||||
return Double(intValue / 256.0)
|
||||
case SMCDataType.SP87.rawValue:
|
||||
let intValue: Double = Double(Int(val.bytes[0]) * 256 + Int(val.bytes[1]))
|
||||
return Double(intValue / 128)
|
||||
case SMCDataType.SP96.rawValue:
|
||||
let intValue: Double = Double(Int(val.bytes[0]) * 256 + Int(val.bytes[1]))
|
||||
return Double(intValue / 64)
|
||||
case SMCDataType.SPB4.rawValue:
|
||||
let intValue: Double = Double(Int(val.bytes[0]) * 256 + Int(val.bytes[1]))
|
||||
return Double(intValue / 16)
|
||||
case SMCDataType.SPF0.rawValue:
|
||||
let intValue: Double = Double(Int(val.bytes[0]) * 256 + Int(val.bytes[1]))
|
||||
return intValue
|
||||
case SMCDataType.FLT.rawValue:
|
||||
let value: Float? = Float(val.bytes)
|
||||
if value != nil {
|
||||
|
||||
@@ -253,6 +253,17 @@ public extension Double {
|
||||
return "n/a"
|
||||
}
|
||||
}
|
||||
|
||||
func localizeTemperature() -> Measurement<UnitTemperature> {
|
||||
let locale = NSLocale.current as NSLocale
|
||||
var unit = UnitTemperature.celsius
|
||||
if let unitLocale = locale.object(forKey: NSLocale.Key(rawValue: "kCFLocaleTemperatureUnitKey")) {
|
||||
unit = "\(unitLocale)" == "Celsius" ? UnitTemperature.celsius : UnitTemperature.fahrenheit
|
||||
}
|
||||
let measurement = Measurement(value: self, unit: unit)
|
||||
|
||||
return measurement
|
||||
}
|
||||
}
|
||||
|
||||
public extension NSView {
|
||||
@@ -391,6 +402,12 @@ extension UInt32 {
|
||||
}
|
||||
}
|
||||
|
||||
extension UInt16 {
|
||||
init(bytes: (UInt8, UInt8)) {
|
||||
self = UInt16(bytes.0) << 8 | UInt16(bytes.1)
|
||||
}
|
||||
}
|
||||
|
||||
extension FourCharCode {
|
||||
init(fromString str: String) {
|
||||
precondition(str.count == 4)
|
||||
|
||||
Reference in New Issue
Block a user