perf(menubar): 降低绘制驻留并复用原生进程表与缩略图

This commit is contained in:
2026-11-04 10:39:15 +08:00
parent 1c26fc18f3
commit 065c53622a
28 changed files with 964 additions and 160 deletions
+1 -4
View File
@@ -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)
}
}
}