refactor(process): 简化进程表并统一表头排序与应用图标
This commit is contained in:
@@ -269,7 +269,6 @@ extension MenuPanelView {
|
||||
|
||||
struct EnergyProcessListRow: View {
|
||||
let process: ProcessMetrics
|
||||
@State private var icon: NSImage?
|
||||
|
||||
private var progress: Double {
|
||||
guard let value = process.cpu, value.isFinite else { return 0 }
|
||||
@@ -278,15 +277,7 @@ struct EnergyProcessListRow: View {
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 5) {
|
||||
Group {
|
||||
if let icon {
|
||||
Image(nsImage: icon).resizable().interpolation(.high)
|
||||
} else {
|
||||
Image(systemName: "app.dashed").resizable().scaledToFit().padding(2)
|
||||
}
|
||||
}
|
||||
.frame(width: 15, height: 15)
|
||||
.accessibilityHidden(true)
|
||||
ProcessIcon(process: process)
|
||||
Text(verbatim: process.name).lineLimit(1).truncationMode(.middle)
|
||||
.frame(width: 66, alignment: .leading)
|
||||
GeometryReader { proxy in
|
||||
@@ -306,11 +297,6 @@ struct EnergyProcessListRow: View {
|
||||
}
|
||||
.font(PanelStyle.label)
|
||||
.frame(height: 16)
|
||||
.task(id: process.id) {
|
||||
icon = NSRunningApplication(processIdentifier: process.id.pid)?.icon
|
||||
if icon == nil, let path = process.path {
|
||||
icon = NSWorkspace.shared.icon(forFile: path)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user