mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix: moved DispatchSource.MemoryPressureEvent to custom RAMPressure enum. Fixed the crashes on some macs (#2212)
This commit is contained in:
@@ -394,3 +394,20 @@ extension SizeUnit: CaseIterable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum RAMPressure: String, Codable {
|
||||
case normal
|
||||
case warning
|
||||
case critical
|
||||
|
||||
func pressureColor() -> NSColor {
|
||||
switch self {
|
||||
case .normal:
|
||||
return NSColor.systemGreen
|
||||
case .warning:
|
||||
return NSColor.systemYellow
|
||||
case .critical:
|
||||
return NSColor.systemRed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user