perf(menubar): 降低绘制驻留并复用原生进程表与缩略图
This commit is contained in:
@@ -20,10 +20,7 @@ struct ProcessIcon: View {
|
||||
guard PanelResourceAudit.omitted != "icons" else { return }
|
||||
// Resolve by the sampled executable, avoiding an icon from a reused PID.
|
||||
guard let path = process.path else { icon = nil; return }
|
||||
let url = URL(fileURLWithPath: path)
|
||||
let app = sequence(first: url, next: { $0.path == "/" ? nil : $0.deletingLastPathComponent() })
|
||||
.first { $0.pathExtension == "app" }
|
||||
icon = NSWorkspace.shared.icon(forFile: (app ?? url).path)
|
||||
icon = ProcessIconCache.shared.image(for: path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user