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
A list row and its page give one figure for what can move
Țugui Dragoș730c5d7c868b
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swiftindex 3d9447af..608be4b9 100644--- a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift@@ -44,6 +44,11 @@ public struct OrphanGroup: Sendable, Hashable, Identifiable {SizeTotal(items.map(\.size))}+ /// What moving the group could free: items Peel leaves alone are listed but not counted, as on an app's page.+ public var movable: SizeTotal {+ SizeTotal(items.filter { $0.leftAlone == nil }.map(\.size))+ }+public var lastModified: Date? {items.compactMap(\.modificationDate).max()}diff --git a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swiftindex 3c3a372a..0f99ebaf 100644--- a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift+++ b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift@@ -39,9 +39,11 @@ public struct PackageReceipt: Sendable, Hashable, Identifiable {public var id: String { identifier }- /// Unknown when the file list is, since an empty list then says nothing about what is left.- public var total: SizeTotal {- isFileListKnown ? SizeTotal(items.map(\.size)) : SizeTotal(known: 0, isComplete: false)+ /// What forgetting the package's files could free: items Peel leaves alone are listed but not counted. Unknown+ /// when the file list is, since an empty list then says nothing about what is left.+ public var movable: SizeTotal {+ guard isFileListKnown else { return SizeTotal(known: 0, isComplete: false) }+ return SizeTotal(items.filter { !$0.isLeftAlone }.map(\.size))}/// True when the package still has files on disk but none of them can be moved: each is excluded, protected,diff --git a/Packages/PeelCore/Tests/PeelCoreTests/MovableTotalTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/MovableTotalTests.swiftnew file mode 100644index 00000000..2b88a74e--- /dev/null+++ b/Packages/PeelCore/Tests/PeelCoreTests/MovableTotalTests.swift@@ -0,0 +1,39 @@+import Foundation+@testable import PeelCore+import Testing++/// A list shows what a page would move, so a row and the page it opens never give two figures for one thing.+struct MovableTotalTests {+ @Test func anOrphanGroupCountsOnlyWhatCanMove() {+ var library = OrphanItem(+ url: URL(filePath: "/Users/x/Pictures/org.example.gone"), kind: .elsewhere, size: 1_000,+ modificationDate: nil, requiresPrivileges: false+ )+ library.heldBack = .holdsALibrary+ let cache = OrphanItem(+ url: URL(filePath: "/Users/x/Library/Caches/org.example.gone"), kind: .caches, size: 10,+ modificationDate: nil, requiresPrivileges: false+ )+ let group = OrphanGroup(identifier: "org.example.gone", items: [library, cache])++ #expect(group.total == SizeTotal(known: 1_010, isComplete: true))+ #expect(group.movable == SizeTotal(known: 10, isComplete: true))+ }++ @Test func aReceiptCountsOnlyWhatCanMove() {+ var tool = PackageReceipt.Item(+ url: URL(filePath: "/usr/local/bin/org.example.tool"), size: 500, requiresPrivileges: true+ )+ tool.isLeftAlone = true+ let app = PackageReceipt.Item(+ url: URL(filePath: "/Applications/Example.app"), size: 20, requiresPrivileges: false+ )+ var receipt = PackageReceipt(+ identifier: "org.example.pkg", version: nil, installDate: nil, volume: URL(filePath: "/"), items: [tool, app]+ )++ #expect(receipt.movable == SizeTotal(known: 20, isComplete: true))+ receipt.isFileListKnown = false+ #expect(receipt.movable == SizeTotal(known: 0, isComplete: false))+ }+}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swiftindex 2e367799..ee08e719 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift@@ -171,7 +171,7 @@ struct PackageReceiptsTests {#expect(receipt.identifier == "com.example.quiet")#expect(!receipt.isFileListKnown)#expect(!receipt.holdsNothingToRemove, "an unknown file list read as \"Nothing Peel moves\"")- #expect(!receipt.total.isComplete, "an unknown file list read as a size of zero")+ #expect(!receipt.movable.isComplete, "an unknown file list read as a size of zero")}/// A `pkgid` found that way says only that some package lists a path ending like this one.diff --git a/Peel/Model/FoundLastTimeStore.swift b/Peel/Model/FoundLastTimeStore.swiftindex 3659a362..516e2295 100644--- a/Peel/Model/FoundLastTimeStore.swift+++ b/Peel/Model/FoundLastTimeStore.swift@@ -43,7 +43,7 @@ extension AppLibrary {extension OrphanLibrary {var looked: Looked? {- scan.map { Looked(count: $0.groups.count, size: SizeTotal(combining: $0.groups.map(\.total))) }+ scan.map { Looked(count: $0.groups.count, size: SizeTotal(combining: $0.groups.map(\.movable))) }}}diff --git a/Peel/Views/Orphans/OrphanDetailView.swift b/Peel/Views/Orphans/OrphanDetailView.swiftindex 1f3d1cda..8f1c4c43 100644--- a/Peel/Views/Orphans/OrphanDetailView.swift+++ b/Peel/Views/Orphans/OrphanDetailView.swift@@ -73,12 +73,6 @@ struct OrphanDetailView: View {return lines.isEmpty ? nil : lines.joined(separator: "\n\n")}- /// The total size that can be moved to the Trash. Items Peel leaves alone are listed but not counted, as- /// on an app's page.- private var movable: SizeTotal {- SizeTotal(group.items.filter { $0.leftAlone == nil }.map(\.size))- }-private var header: some View {PageHeader(systemImage: "questionmark.folder") {Text(verbatim: group.title)@@ -105,8 +99,8 @@ struct OrphanDetailView: View {.foregroundStyle(.secondary)}} trailing: {- TotalLabel(total: movable, caption: Text("to remove"))- .accessibilityLabel(Text("\(movable.text) can be moved to the Trash"))+ TotalLabel(total: group.movable, caption: Text("to remove"))+ .accessibilityLabel(Text("\(group.movable.text) can be moved to the Trash"))}}diff --git a/Peel/Views/Orphans/OrphanList.swift b/Peel/Views/Orphans/OrphanList.swiftindex 80c35230..af328042 100644--- a/Peel/Views/Orphans/OrphanList.swift+++ b/Peel/Views/Orphans/OrphanList.swift@@ -106,7 +106,7 @@ private struct OrphanGroupRow: View {.rowTint(group.confidence.tint)}Spacer(minLength: 6)- Text(group.total.text)+ Text(group.movable.text).rowFigure()}.padding(.vertical, 2)diff --git a/Peel/Views/Packages/PackageDetailView.swift b/Peel/Views/Packages/PackageDetailView.swiftindex 4ec43785..14ae0c9c 100644--- a/Peel/Views/Packages/PackageDetailView.swift+++ b/Peel/Views/Packages/PackageDetailView.swift@@ -144,19 +144,13 @@ struct PackageDetailView: View {}}} trailing: {- if movable.known > 0 || !movable.isComplete {- TotalLabel(total: movable, caption: Text("to remove"))- .accessibilityLabel(Text("\(movable.text) can be moved to the Trash"))+ if receipt.movable.known > 0 || !receipt.movable.isComplete {+ TotalLabel(total: receipt.movable, caption: Text("to remove"))+ .accessibilityLabel(Text("\(receipt.movable.text) can be moved to the Trash"))}}}- /// The total size that can be moved to the Trash. Items Peel leaves alone are listed but not counted, as- /// on an app's page.- private var movable: SizeTotal {- SizeTotal(receipt.items.filter { !$0.isLeftAlone }.map(\.size))- }-/// The selected items of this receipt. `packages.selectedURLs` is one set shared by all receipts, so it is/// filtered to this receipt's items.private var selectedItems: [PackageReceipt.Item] {diff --git a/Peel/Views/Packages/PackageList.swift b/Peel/Views/Packages/PackageList.swiftindex b9a72885..749f3d11 100644--- a/Peel/Views/Packages/PackageList.swift+++ b/Peel/Views/Packages/PackageList.swift@@ -31,7 +31,7 @@ struct PackageList: View {}Spacer(minLength: 6)if !receipt.nothingLeftOnDisk, !receipt.holdsNothingToRemove {- Text(receipt.total.text)+ Text(receipt.movable.text).rowFigure()}}