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
Let the keyboard select a file in File Search
Țugui Dragoș17e4846659f4
diff --git a/GUIDE.md b/GUIDE.mdindex aa072787..fce8588d 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -161,8 +161,8 @@ Space shows what fills your disk, area by area, and what each area is.- **Space:** what fills your disk, area by area, and which app or tool each area belongs to.- **File Search:** files by name, kind, or size, and by age along with one of them, in your home folder or across thisMac's disks, not network volumes, found through Spotlight, up to 2,000 at a time, so a folder in System Settings >- Spotlight > Search Privacy isn't searched, and the page names any disk Spotlight isn't indexing.- A file in a Library folder, an app's working data, is listed last and never recommended, and neither is one in a+ Spotlight > Search Privacy isn't searched, and the page names any disk Spotlight isn't indexing. In the list, the+ arrow keys choose a file and Space selects it. A file in a Library folder, an app's working data, is listed last and never recommended, and neither is one in arepository, which may be part of a project's work, or in Shared, which belongs to every account, and one that needsan administrator stays where it is. The page says how many files Spotlight found that it doesn't list, and why: whatsyncs to your other devices, what you excluded, what sits where Peel never moves anything, and what macOS didn't letdiff --git a/Peel/Model/FileSearchLibrary.swift b/Peel/Model/FileSearchLibrary.swiftindex d9e50308..654f6249 100644--- a/Peel/Model/FileSearchLibrary.swift+++ b/Peel/Model/FileSearchLibrary.swift@@ -56,6 +56,14 @@ final class FileSearchLibrary {results?.files.first { $0.url == chosen }}+ /// Selects the chosen file or takes it out, for the keyboard: a list takes focus as a whole, so Tab never reaches+ /// a row's checkbox. False where that checkbox is off.+ func toggleChosen() -> Bool {+ guard let chosenFile, !chosenFile.requiresPrivileges, !isSearching, !isRemoving else { return false }+ setSelected(!isSelected(chosenFile.url), for: chosenFile.url)+ return true+ }+func search() async {generation += 1let current = generationdiff --git a/Peel/Views/FileSearch/FileSearchList.swift b/Peel/Views/FileSearch/FileSearchList.swiftindex f110b0a6..50e88b2b 100644--- a/Peel/Views/FileSearch/FileSearchList.swift+++ b/Peel/Views/FileSearch/FileSearchList.swift@@ -103,6 +103,7 @@ struct FileSearchList: View {}}.accessibilityLabel(Text(Tool.fileSearch.title))+ .onKeyPress(.space) { search.toggleChosen() ? .handled : .ignored }.scrollBarBelowSectionHeaders(search.results?.files.isEmpty == false).scanState(phase, isRescanning: search.isSearching, fadesInResults: false, scan: search.scanRun) {if search.results == nil {diff --git a/PeelTests/FileSearchLibraryTests.swift b/PeelTests/FileSearchLibraryTests.swiftindex b8d27cd4..96797e80 100644--- a/PeelTests/FileSearchLibraryTests.swift+++ b/PeelTests/FileSearchLibraryTests.swift@@ -34,6 +34,29 @@ struct FileSearchLibraryTests {})}+ @Test func theKeyboardSelectsTheChosenFileAndTakesItOutAgain() async throws {+ let locked = URL(filePath: "/org.example/locked.pdf")+ let results = FileSearchResults(files: [+ FoundFile(url: invoice, size: 1, length: 1, modificationDate: .distantPast, requiresPrivileges: false),+ FoundFile(url: locked, size: 1, length: 1, modificationDate: .distantPast, requiresPrivileges: true),+ ])+ let library = FileSearchLibrary { _, _ in results }+ library.criteria.name = "report"+ await library.search()++ #expect(!library.toggleChosen(), "no row is chosen")++ library.chosen = invoice+ #expect(library.toggleChosen())+ #expect(library.isSelected(invoice))+ #expect(library.toggleChosen())+ #expect(!library.isSelected(invoice))++ library.chosen = locked+ #expect(!library.toggleChosen(), "the row's own checkbox is off")+ #expect(!library.isSelected(locked))+ }+@Test func narrowingAnOldListLeavesTheNewOneAlone() async throws {let budget = URL(filePath: "/org.example/budget.pdf")let (first, second) = (found(invoice), found(budget))