BugFix: remove the accidental stats in gitignore

This commit is contained in:
Hariharan Mudaliar 2025-10-15 22:31:28 +05:30
commit 05ec90e840
13 changed files with 1628 additions and 1 deletions

View file

@ -0,0 +1,61 @@
//
// ProcessStats.swift
// DynamicIsland
//
// Process information structure for stats monitoring
// Adapted from boring.notch implementation
import Foundation
import AppKit
import SwiftUI
// Process information structure
struct ProcessStats: Identifiable, Hashable {
let id = UUID()
let pid: Int32
let name: String
let cpuUsage: Double
let memoryUsage: UInt64 // in bytes
let icon: NSImage?
var memoryUsageString: String {
let formatter = ByteCountFormatter()
formatter.allowedUnits = [.useMB, .useGB]
formatter.countStyle = .memory
return formatter.string(fromByteCount: Int64(memoryUsage))
}
var cpuUsageString: String {
return String(format: "%.1f%%", cpuUsage)
}
}
enum ProcessRankingType {
case cpu
case memory
case gpu
var title: String {
switch self {
case .cpu: return "CPU Usage"
case .memory: return "Memory Usage"
case .gpu: return "GPU Usage"
}
}
var icon: String {
switch self {
case .cpu: return "cpu"
case .memory: return "memorychip"
case .gpu: return "display"
}
}
var color: Color {
switch self {
case .cpu: return .blue
case .memory: return .green
case .gpu: return .purple
}
}
}