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
The leftovers shortcut opens the app it found, not one by name
Țugui Dragoș14eb97216b4a
diff --git a/Peel/Navigation/Navigator.swift b/Peel/Navigation/Navigator.swiftindex 71b3ef07..c1d91830 100644--- a/Peel/Navigation/Navigator.swift+++ b/Peel/Navigation/Navigator.swift@@ -2,7 +2,7 @@ import AppKitimport Observationimport SwiftUI-/// Requests to show a tool, or an app by name, that come from outside the sidebar: Shortcuts and Spotlight, the+/// Requests to show a tool, or an app, that come from outside the sidebar: Shortcuts and Spotlight, the/// menu bar panel, or a button on another page. `ContentView` carries out each one and clears it. A request only/// opens a page, where the user can look and decide; it never removes anything.@Observable@@ -10,8 +10,9 @@ final class Navigator {@MainActor static let shared = Navigator()var requestedTool: Tool?- /// The name of an app to open in Applications, as chosen in a Shortcut.- var requestedAppName: String?+ /// An app to open in Applications, as a Shortcut found it on disk, so an app of the same name is never the one+ /// opened, and one installed a moment ago opens before the list has it.+ var requestedApp: URL?/// The app's own action for opening a window, given at launch, which works whatever window is open or closed.@ObservationIgnored var openWindow: OpenWindowAction?diff --git a/Peel/Navigation/PeelIntents.swift b/Peel/Navigation/PeelIntents.swiftindex ee5d53b4..b5e56d11 100644--- a/Peel/Navigation/PeelIntents.swift+++ b/Peel/Navigation/PeelIntents.swift@@ -149,10 +149,10 @@ struct ShowLeftoversInPeel: AppIntent {func perform() async throws -> some IntentResult {// Checked again here, because the app may have been removed after it was chosen. The error lets the// Shortcut handle that case, instead of opening an empty page.- guard await AppCatalog.installedApps().contains(where: { $0.bundleIdentifier == app.id }) else {+ guard let installed = await AppCatalog.installedApps().first(where: { $0.bundleIdentifier == app.id }) else {throw NoSuchApp(name: app.name)}- Navigator.shared.requestedAppName = app.name+ Navigator.shared.requestedApp = installed.urlNavigator.shared.requestedTool = .applicationsreturn .result()}diff --git a/Peel/Views/ContentView.swift b/Peel/Views/ContentView.swiftindex 9840e0ac..7e7d395f 100644--- a/Peel/Views/ContentView.swift+++ b/Peel/Views/ContentView.swift@@ -150,10 +150,10 @@ struct ContentView: View {show(requested)navigator.requestedTool = nil}- .onChange(of: navigator.requestedAppName) { _, name in- guard let name, !name.isEmpty, library.hasLoaded else { return }- navigator.requestedAppName = nil- Task { await reveal(named: name) }+ .onChange(of: navigator.requestedApp) { _, app in+ guard let app, library.hasLoaded else { return }+ navigator.requestedApp = nil+ Task { await library.reveal([app]) }}}@@ -341,21 +341,12 @@ struct ContentView: View {show(requested)navigator.requestedTool = nil}- if let name = navigator.requestedAppName, !name.isEmpty, library.hasLoaded {- navigator.requestedAppName = nil- Task { await reveal(named: name) }+ if let app = navigator.requestedApp, library.hasLoaded {+ navigator.requestedApp = nil+ Task { await library.reveal([app]) }}}- /// A Shortcut asks by name, so the closest installed app wins and nothing happens when there is no match.- private func reveal(named name: String) async {- let wanted = name.lowercased()- let match = library.apps.first { $0.names.contains { $0.lowercased() == wanted } }- ?? library.apps.first { $0.names.contains { SearchText.matches($0, name) } }- guard let match else { return }- await library.reveal([match.url])- }-@ViewBuilderprivate var duplicateDetail: some View {if let group = duplicates.selectedFolderGroup {