fix: corrected sensors value rounding for the widget (#1000)

This commit is contained in:
Serhiy Mytrovtsiy
2022-07-16 22:18:27 +02:00
parent c7a1a92490
commit 7cc17fe856
2 changed files with 3 additions and 9 deletions

View File

@@ -98,14 +98,8 @@ internal struct Sensor: Sensor_p {
switch self.type {
case .temperature:
return Temperature(value).replacingOccurrences(of: "C", with: "").replacingOccurrences(of: "F", with: "")
case .voltage:
let val = value >= 10 ? "\(Int(value))" : String(format: "%.1f", value)
return "\(val)\(unit)"
case .power:
let val = value >= 10 ? "\(Int(value))" : String(format: "%.1f", value)
return "\(val)\(unit)"
case .current:
let val = value >= 10 ? "\(Int(value))" : String(format: "%.1f", value)
case .voltage, .power, .current:
let val = value >= 9.95 ? "\(Int(round(value)))" : String(format: "%.1f", value)
return "\(val)\(unit)"
case .fan:
return "\(Int(value))"

View File

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