Files
luma/Sources/LumaCore/Models/ProcessListing.swift
Ole André Vadla Ravnås 52fcf32ac0 Put the kernel first in the process list
It is the one process nothing else stands in for. Name it as such,
and let the device rows ellipsize rather than widen the column.
2026-09-10 16:30:19 +02:00

17 lines
517 B
Swift

import Foundation
import Frida
extension Sequence where Element == ProcessDetails {
public func sortedWithKernelFirst() -> [ProcessDetails] {
sorted { lhs, rhs in
if (lhs.pid == 0) != (rhs.pid == 0) { return lhs.pid == 0 }
let lhsHasIcon = !lhs.icons.isEmpty
let rhsHasIcon = !rhs.icons.isEmpty
if lhsHasIcon != rhsHasIcon { return lhsHasIcon }
return lhs.name.localizedCaseInsensitiveCompare(rhs.name) == .orderedAscending
}
}
}