Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Orphaned Files lets you say which app a group belongs to
Țugui Dragoș10f3042a1b48
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 144e6f17..765003e0 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -66633,6 +66633,112 @@}}},+ "No orphaned files are said to belong to an app." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "U žádných osiřelých souborů jste zatím neuvedli, že patří některé aplikaci."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Für keine verwaisten Dateien wurde angegeben, dass sie zu einer App gehören."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "No has indicado que ningún archivo huérfano pertenezca a una app."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Aucun fichier orphelin n’a été attribué à une app."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nessun file orfano è indicato come appartenente a un’app."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "アプリに属すると指定した孤立ファイルはありません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "앱의 소유로 지정한 주인 없는 파일이 없습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Van geen verweesde bestanden is aangegeven dat ze bij een app horen."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nie wskazano żadnych osieroconych plików jako należących do aplikacji."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nenhum arquivo órfão foi indicado como pertencente a um app."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Niciun fișier orfan nu este indicat ca aparținând unei aplicații."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Нет осиротевших файлов, отмеченных как принадлежащие приложению."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Du har inte angett att några övergivna filer hör till en app."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Bir uygulamaya ait olduğunu söylediğiniz sahipsiz dosya yok."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ви ще не вказали, що якісь покинуті файли належать програмі."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "还没有被标为属于某个App的孤立文件。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "你還沒有指定任何孤立檔案屬於某個App。"+ }+ }+ }+ },"No orphaned files were found, but Peel couldn’t look in ^[%lld folder](inflect: true), so there may be some there. Give Peel Full Disk Access to look there too." : {"localizations" : {"cs" : {@@ -77913,6 +78019,218 @@}}},+ "Orphaned Files That Belong to an App" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Osiřelé soubory, které patří aplikaci"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Verwaiste Dateien, die zu einer App gehören"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Archivos huérfanos que pertenecen a una app"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Fichiers orphelins appartenant à une app"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "File orfani che appartengono a un’app"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "アプリに属する孤立ファイル"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "앱의 소유로 지정한 주인 없는 파일"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Verweesde bestanden die bij een app horen"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Osierocone pliki należące do aplikacji"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Arquivos Órfãos que Pertencem a um App"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Fișiere orfane care aparțin unei aplicații"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Осиротевшие файлы, принадлежащие приложению"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Övergivna filer som hör till en app"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Bir Uygulamaya Ait Sahipsiz Dosyalar"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Покинуті файли, що належать програмі"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "属于某个App的孤立文件"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "屬於某個App的孤立檔案"+ }+ }+ }+ },+ "Orphaned Files doesn’t list these while the app you said they belong to is installed. Nothing of them was moved. Remove one to list it again." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stránka Osiřelé soubory je nezobrazuje, dokud je nainstalovaná aplikace, o které jste uvedli, že jí patří. Nic z nich nebylo přesunuto. Chcete-li některou položku znovu zobrazit, odeberte ji."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Die Seite „Verwaiste Dateien“ zeigt diese nicht an, solange die App installiert ist, zu der sie laut deiner Angabe gehören. Nichts davon wurde verschoben. Entferne einen Eintrag, damit er dort wieder angezeigt wird."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "La página Archivos huérfanos no los muestra mientras esté instalada la app a la que has indicado que pertenecen. No se ha trasladado nada de ellos. Elimina uno para volver a mostrarlo."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "La page Fichiers orphelins ne les liste pas tant que l’app à laquelle vous les avez attribués est installée. Aucun d’eux n’a été déplacé. Retirez-en un pour qu’il soit de nouveau listé."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "“File orfani” non elenca questi file finché è installata l’app a cui hai detto che appartengono. Nessuno di questi è stato spostato. Rimuovine uno per elencarlo di nuovo."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "指定したアプリがインストールされている間は、“孤立ファイル”にこれらを表示しません。どの項目も移動していません。再び表示するには、リストから削除してください。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "주인 없는 파일 페이지는 소유 앱으로 지정한 앱이 설치되어 있는 동안 이 파일들을 나열하지 않습니다. 이 파일은 하나도 이동되지 않았습니다. 다시 나열하려면 목록에서 제거하십시오."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "De pagina 'Verweesde bestanden' toont deze niet zolang de app waarbij ze volgens jou horen, geïnstalleerd is. Niets ervan is verplaatst. Verwijder er een om die weer te tonen."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Strona Osierocone pliki nie wyświetla ich, dopóki aplikacja, do której według Ciebie należą, jest zainstalowana. Nic z nich nie przeniesiono. Usuń pozycję, aby znów była wyświetlana."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "A página Arquivos Órfãos não lista estes itens enquanto o app ao qual você disse que eles pertencem estiver instalado. Nenhum deles foi movido. Remova um para que ele volte a ser listado."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Pagina Fișiere orfane nu le listează cât timp aplicația căreia ați spus că îi aparțin este instalată. Niciunul dintre fișiere nu a fost mutat. Eliminați un grup pentru a‑l lista din nou."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Раздел «Осиротевшие файлы» не показывает эти файлы, пока установлено приложение, которому они, по Вашим словам, принадлежат. Ничего из них не перемещено. Уберите запись, и ее файлы снова появятся в списке."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Sidan Övergivna filer visar inte de här så länge appen du angav att de hör till är installerad. Inget av dem har flyttats. Ta bort en för att visa den igen."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Sahipsiz Dosyalar, ait olduklarını söylediğiniz uygulama yüklü olduğu sürece bunları listelemez. Hiçbiri taşınmadı. Birini yeniden listelemek için onu kaldırın."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Розділ «Покинуті файли» не показує їх, поки інстальовано програму, якій вони, за вашими словами, належать. Нічого з них не переміщено. Вилучіть запис, щоб розділ знову його показував."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "只要你指定它们所属的App仍已安装,“孤立文件”就不会列出这些项目。它们都没有被移动。移除其中一项即可再次列出它。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "只要你指定它們所屬的App仍已安裝,「孤立檔案」就不會列出它們。這些檔案都沒有被移動。移除其中一項,即可再次列出它。"+ }+ }+ }+ },"Outside the app, Peel found nothing that belongs to this package alone." : {"localizations" : {"cs" : {@@ -122586,6 +122904,112 @@}}},+ "This Belongs To" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Patří aplikaci"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Gehört zu"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Pertenece a"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Appartient à"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Appartiene a"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "所属先のアプリ"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "소유한 앱 지정"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dit hoort bij"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Należy do"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Isto Pertence a"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Aparține aplicației"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Принадлежит приложению"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Det här hör till"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Şuna Ait"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Належить програмі"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "归属于"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "屬於"+ }+ }+ }+ },"This Mac" : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swiftindex 6583bc3c..608e6476 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift@@ -71,7 +71,9 @@ struct OrphansCommand: AsyncParsableCommand {let running = Set(await RunningCopies.current.map(\.bundleIdentifier))let exclusions = await UnreadableExclusions.load()let scanner = OrphanScanner(exclusions: exclusions)- let scan = await scanner.scan(installedApps: apps, remembered: remembered, running: running)+ let scan = await scanner.scan(+ installedApps: apps, remembered: remembered, running: running, owners: OrphanOwners().load()+ )if let group {return try await clean(group, in: scan, apps: apps, scanner: scanner, using: TrashService(exclusions: exclusions))}diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swiftindex c072adb6..5312a914 100644--- a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift@@ -50,4 +50,9 @@ public struct OrphanGroup: Sendable, Hashable, Identifiable {public struct OrphanScan: Sendable {public let groups: [OrphanGroup]public let unreadableLocations: [SearchLocation]++ /// The same scan without the group `id`, as when the person said it belongs to an app.+ public func without(_ id: OrphanGroup.ID) -> OrphanScan {+ OrphanScan(groups: groups.filter { $0.id != id }, unreadableLocations: unreadableLocations)+ }}diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanOwners.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanOwners.swiftnew file mode 100644index 00000000..b9fb2e3e--- /dev/null+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanOwners.swift@@ -0,0 +1,49 @@+public import Foundation++/// The orphaned files the person said belong to an installed app, by the identifier of their group, so Orphaned+/// Files stops listing them while that app is installed. It only ever takes rows out of the list: nothing is moved.+public struct OrphanOwners: Sendable {+ public let url: URL++ public init(url: URL = OrphanOwners.defaultURL) {+ self.url = url+ }++ public static var defaultURL: URL {+ PeelFolder.url.appending(path: "orphan-owners.json")+ }++ /// Each group's identifier, lowercased, and the bundle identifier of the app it belongs to. A file that cannot be+ /// read gives none, which only lists those groups again.+ public func load() -> [String: String] {+ FileLock.whileHeld(beside: url) { read() ?? [:] }+ }++ /// Records that `group` belongs to the app `bundleIdentifier`. False when the choice could not be saved, or when+ /// the file is there and cannot be read, since writing over it would lose the choices it holds.+ @discardableResult+ public func give(_ group: String, to bundleIdentifier: String) -> Bool {+ change { $0[group.lowercased()] = bundleIdentifier }+ }++ /// Forgets which app each of `groups` belongs to, so they are listed again.+ @discardableResult+ public func take(_ groups: [String]) -> Bool {+ change { owners in groups.forEach { owners[$0.lowercased()] = nil } }+ }++ private func change(_ edit: (inout [String: String]) -> Void) -> Bool {+ FileLock.whileHeld(beside: url) {+ guard var owners = read() ?? (url.isMissing ? [:] : nil) else { return false }+ edit(&owners)+ guard let data = try? JSONEncoder().encode(owners) else { return false }+ try? FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)+ return (try? data.write(to: url, options: .atomic)) != nil+ }+ }++ private func read() -> [String: String]? {+ guard let data = BoundedRead.data(at: url) else { return nil }+ return try? JSONDecoder().decode([String: String].self, from: data)+ }+}diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swiftindex c2301964..75777a7b 100644--- a/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/OrphanScanner.swift@@ -37,12 +37,14 @@ public struct OrphanScanner: Sendable {/// `installedApps` must be the complete list: anything it does not claim can be reported as orphaned./// `remembered` holds the apps Peel has seen installed before, so a group can be named after the app that/// left it. `running` holds the bundle identifiers of what is running now: a helper or an agent can keep a- /// folder that no app bundle claims, and while it runs, its group is marked unsure.+ /// folder that no app bundle claims, and while it runs, its group is marked unsure. `owners` are the groups the+ /// person said belong to an app (`OrphanOwners`), left out while that app is installed.@concurrentpublic func scan(installedApps: [InstalledApp],remembered: [RememberedApp] = [],- running: Set<String> = []+ running: Set<String> = [],+ owners: [String: String] = [:]) async -> OrphanScan {let systemApps = if let systemApps { systemApps } else { await AppCatalog.systemApps.value }let ownership = AppOwnership(installedApps: installedApps + systemApps, isRegisteredApp: isRegisteredApp)@@ -83,6 +85,7 @@ public struct OrphanScanner: Sendable {let reach = HelperReach(environment: environment)let kept = found.filter {!exclusions.excludes($0.item.url) && !exclusions.holds($0.item.url) && !exclusions.excludes(bundleIdentifier: $0.identifier)+ && !(owners[$0.identifier.lowercased()].map { here.contains($0.lowercased()) } ?? false)}.map { entry inguard entry.item.requiresPrivileges, entry.item.leftAlone == nil, reach.isBeyond(entry.item.url) else { return entry }diff --git a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swiftindex 51e370b3..cc632785 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/OrphanScannerTests.swift@@ -203,6 +203,34 @@ struct OrphanScannerTests {#expect(group.confidence.level != .certain)}+ /// A group the person said belongs to an installed app is not listed while that app is installed. Once the app+ /// is gone, the files are orphaned again.+ @Test func aGroupThePersonGaveToAnInstalledAppIsNotListed() async throws {+ let directory = try TemporaryDirectory()+ try directory.file("home/Library/Application Support/org.example.helper/state.db")+ try directory.file("home/Library/Caches/org.example.other/cache.db")+ let scanner = scanner(in: directory)++ let given = await scanner.scan(installedApps: installed, owners: ["org.example.helper": "com.installed.app"])+ #expect(given.groups.map(\.identifier) == ["org.example.other"])++ let ownerGone = await scanner.scan(installedApps: installed, owners: ["org.example.helper": "org.example.gone"])+ #expect(Set(ownerGone.groups.map(\.identifier)) == ["org.example.helper", "org.example.other"])+ }++ @Test func remembersWhichAppAGroupBelongsToUntilToldOtherwise() throws {+ let directory = try TemporaryDirectory()+ let owners = OrphanOwners(url: directory.url.appending(path: "orphan-owners.json"))+ #expect(owners.load() == [:])++ #expect(owners.give("org.example.Helper", to: "com.installed.app"))+ #expect(owners.give("org.example.other", to: "com.microsoft.Word"))+ #expect(owners.load() == ["org.example.helper": "com.installed.app", "org.example.other": "com.microsoft.Word"])++ #expect(owners.take(["org.example.helper"]))+ #expect(owners.load() == ["org.example.other": "com.microsoft.Word"])+ }+/// An app installed since the scan owns what the list still calls orphaned.@Test func whatAnAppInstalledSinceClaimsIsNoLongerOrphaned() async throws {let directory = try TemporaryDirectory()diff --git a/Peel/Model/OrphanLibrary.swift b/Peel/Model/OrphanLibrary.swiftindex cf56c20d..e80257f2 100644--- a/Peel/Model/OrphanLibrary.swift+++ b/Peel/Model/OrphanLibrary.swift@@ -15,6 +15,8 @@ final class OrphanLibrary {/// The revision of the apps list the scan was checked against. The page scans again when the list changes.private(set) var scannedRevision: Int?+ /// The groups the person said belong to an app, by identifier, with that app's bundle identifier.+ private(set) var owners = OrphanOwners().load()var selectedGroup: OrphanGroup? {scan?.groups.first { $0.id == selection }@@ -29,13 +31,15 @@ final class OrphanLibrary {// check this too; checking here keeps a new caller from getting it wrong.guard !library.apps.isEmpty else { return }let (installedApps, revision) = (library.apps, library.revision)+ let owners = OrphanOwners().load()+ self.owners = ownersguard let result = await scanRun.run({let remembered = await AppMemory().remember(installedApps)// What is currently running is better evidence than anything worked out from what is installed: a// helper or an agent can keep a folder that no app bundle claims.let running = Set(NSWorkspace.shared.runningApplications.compactMap(\.bundleIdentifier))return await OrphanScanner(exclusions: ExclusionsStore.shared.exclusions)- .scan(installedApps: installedApps, remembered: remembered, running: running)+ .scan(installedApps: installedApps, remembered: remembered, running: running, owners: owners)}) else { return }let remainingURLs = Set(result.groups.flatMap(\.items).filter { $0.leftAlone == nil }.map(\.url))scan = result@@ -46,6 +50,21 @@ final class OrphanLibrary {}}+ /// Takes `group` out of the list, as the person said it belongs to `app`. Nothing moves, and the group stays+ /// listed when the choice could not be saved.+ func give(_ group: OrphanGroup, to app: InstalledApp) {+ guard OrphanOwners().give(group.identifier, to: app.bundleIdentifier), let scan else { return }+ owners[group.identifier.lowercased()] = app.bundleIdentifier+ self.scan = scan.without(group.id)+ selectedURLs.subtract(group.items.map(\.url))+ if selection == group.id { selection = nil }+ }++ /// Lists `groups` again, forgetting the app each was given to.+ func forget(_ groups: [String], from library: AppLibrary) async {+ guard OrphanOwners().take(groups) else { return }+ await refresh(from: library)+ }}extension OrphanLibrary: CarriesSelection {diff --git a/Peel/PeelApp.swift b/Peel/PeelApp.swiftindex 39f3908d..128abae9 100644--- a/Peel/PeelApp.swift+++ b/Peel/PeelApp.swift@@ -341,6 +341,7 @@ struct PeelApp: App {.environment(history).environment(home).environment(background)+ .environment(orphans)}.windowResizability(.contentSize)diff --git a/Peel/Views/Orphans/OrphanList.swift b/Peel/Views/Orphans/OrphanList.swiftindex 886e29f6..80c35230 100644--- a/Peel/Views/Orphans/OrphanList.swift+++ b/Peel/Views/Orphans/OrphanList.swift@@ -15,6 +15,16 @@ struct OrphanList: View {List(filtered, selection: $orphans.selection) { group inOrphanGroupRow(group: group)}+ .contextMenu(forSelectionType: OrphanGroup.ID.self) { ids in+ if ids.count == 1, let group = filtered.first(where: { ids.contains($0.id) }) {+ Menu("This Belongs To") {+ let apps = library.apps.sorted { $0.name.localizedStandardCompare($1.name) == .orderedAscending }+ ForEach(apps) { app in+ Button(app.name) { orphans.give(group, to: app) }+ }+ }+ }+ }.scanState(phase(filtered), isRescanning: isRescanning, scan: orphans.scanRun) {if orphans.scan?.groups.isEmpty == true, let unreadable = orphans.scan?.unreadableLocations, !unreadable.isEmpty {ContentUnavailableView {diff --git a/Peel/Views/Settings/ExclusionsSettingsView.swift b/Peel/Views/Settings/ExclusionsSettingsView.swiftindex 662346da..55ab3802 100644--- a/Peel/Views/Settings/ExclusionsSettingsView.swift+++ b/Peel/Views/Settings/ExclusionsSettingsView.swift@@ -5,10 +5,12 @@ import UniformTypeIdentifiersstruct ExclusionsSettingsView: View {@Environment(ExclusionsStore.self) private var exclusions@Environment(AppLibrary.self) private var library+ @Environment(OrphanLibrary.self) private var orphans@State private var isChoosingPaths = false@State private var refused: [String] = []@State private var selectedPaths: Set<URL> = []@State private var selectedApps: Set<String> = []+ @State private var selectedGroups: Set<String> = []private var paths: [URL] {exclusions.exclusions.paths.sorted { $0.path(percentEncoded: false) < $1.path(percentEncoded: false) }@@ -146,6 +148,42 @@ struct ExclusionsSettingsView: View {} header: {heading("Apps", "Excluded apps still appear in Applications, but Peel won’t offer to remove or reset them. The Storage pages, Plug-ins, and Package Receipts go by files and folders only, so to protect an app’s files there, exclude its folders above as well.")}++ Section {+ let groups = orphans.owners.keys.sorted()+ if groups.isEmpty {+ Text("No orphaned files are said to belong to an app.")+ .foregroundStyle(.secondary)+ } else {+ List(selection: $selectedGroups) {+ ForEach(groups, id: \.self) { group in+ HStack(spacing: 8) {+ Text(verbatim: group)+ .lineLimit(1)+ .truncationMode(.middle)+ if let owner = orphans.owners[group] {+ Text(verbatim: library.apps.first { $0.bundleIdentifier == owner }?.name ?? owner)+ .font(.caption)+ .foregroundStyle(.secondary)+ .lineLimit(1)+ }+ }+ .tag(group)+ }+ }+ .frame(height: Self.listHeight(rows: groups.count))+ .scrollContentBackground(.hidden)+ .onDeleteCommand { forgetSelectedGroups() }+ }+ HStack {+ Spacer()+ Button("Remove", systemImage: "minus") { forgetSelectedGroups() }+ .disabled(selectedGroups.isEmpty)+ }+ .editingControls()+ } header: {+ heading("Orphaned Files That Belong to an App", "Orphaned Files doesn’t list these while the app you said they belong to is installed. Nothing of them was moved. Remove one to list it again.")+ }}.formStyle(.grouped)// `.folder` is listed as well as `.item`: with `.item` alone, the panel doesn't let the user choose a@@ -171,6 +209,14 @@ struct ExclusionsSettingsView: View {}}+extension ExclusionsSettingsView {+ private func forgetSelectedGroups() {+ let forgotten = Array(selectedGroups)+ selectedGroups = []+ Task { await orphans.forget(forgotten, from: library) }+ }+}+private extension View {/// Styles the buttons that add to a list and remove from it as small bordered buttons, 20 points high, the/// HIG's minimum on the Mac. A borderless pull-down stays 16 points high at every control size, so all four