mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix temperature visibility in popup
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<key>Name</key>
|
||||
<string>Sensors</string>
|
||||
<key>State</key>
|
||||
<true/>
|
||||
<false/>
|
||||
<key>Widgets</key>
|
||||
<dict>
|
||||
<key>sensors</key>
|
||||
|
||||
@@ -55,7 +55,9 @@ struct Sensor_t {
|
||||
get {
|
||||
switch self.type {
|
||||
case SensorType.Temperature.rawValue:
|
||||
return MeasurementFormatter().string(from: (value ?? 0).localizeTemperature())
|
||||
let formatter = MeasurementFormatter()
|
||||
formatter.numberFormatter.maximumFractionDigits = 0
|
||||
return formatter.string(from: (value ?? 0).localizeTemperature())
|
||||
case SensorType.Voltage.rawValue:
|
||||
return String(format: "%.3f \(unit)", value ?? 0)
|
||||
case SensorType.Power.rawValue:
|
||||
|
||||
@@ -541,3 +541,12 @@ public func PopupRow(_ view: NSView, n: CGFloat, title: String, value: String) -
|
||||
|
||||
return valueView
|
||||
}
|
||||
|
||||
public extension Array where Element : Equatable {
|
||||
func allEqual() -> Bool {
|
||||
if let firstElem = first {
|
||||
return !dropFirst().contains { $0 != firstElem }
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user