Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Say after a removal that macOS starts an app's items from the Trash, on macOS 26 too

Țugui Dragoșcfdba470e2b4
diff --git a/GUIDE.md b/GUIDE.md
index 8746de7a..10660a83 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -74,7 +74,7 @@ and how to get it, [SAFETY.md](SAFETY.md) what it protects, [PRIVACY.md](PRIVACY
unless you deselect it, and History puts it back where it was when you put the app back. An app you had already
moved to the Trash loses its icon once the files it left behind move, and History doesn't put that icon back.
- **When macOS needs more.** After a removal, Peel says when macOS keeps using what moved: an audio driver until
- you restart your Mac, and, on macOS 27, an app's login items, which macOS starts from the Trash until you empty it.
+ you restart your Mac, and an app's login items, which macOS starts from the Trash until you empty it.
- **A root certificate stays trusted.** Before an app such as Charles or Proxyman goes, or a tool such as mkcert,
Caddy, or mitmproxy is uninstalled on the Homebrew page, Peel says that the root certificate it added stays trusted
on this Mac, and how its maker, or Keychain Access, stops trusting it. Peel never changes a keychain.
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift
index cacb4a63..c20590f9 100644
--- a/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Removal/TrashService.swift
@@ -325,11 +325,7 @@ public struct TrashService: Sendable {
runningInside: { await LaunchdCleanup.running(inside: $0, environment: environment) },
stopRunning: { await LaunchdCleanup.stop($0, canUseHelper: $1) },
runningJobs: { await Launchctl.runningJobs() },
- // Seen on macOS 27, which is where the note that reads it is shown.
- registrationAtLogin: { app in
- guard #available(macOS 27, *) else { return nil }
- return await StartsAtLogin.registration(of: app)
- },
+ registrationAtLogin: { await StartsAtLogin.registration(of: $0) },
registerApp: { app in _ = LSRegisterURL(app as CFURL, true) },
moveToTrash: { try Self.moveToSystemTrash($0, refusal: removalGuard.refusal(of:)) },
ownMoves: .shared,
diff --git a/Peel/Views/RemovalFailureAlert.swift b/Peel/Views/RemovalFailureAlert.swift
index c12b2d4b..392098cb 100644
--- a/Peel/Views/RemovalFailureAlert.swift
+++ b/Peel/Views/RemovalFailureAlert.swift
@@ -5,8 +5,8 @@ import SwiftUI
/// The alert every tool shows when a removal fails for some items: which ones, and why, with a button that
/// fixes the cause when there is one. It also reports the privacy resets worth telling about, the audio drivers that
-/// wait for a restart, what stays for an administrator, and on macOS 27 the background items macOS still starts from
-/// the Trash, since two alerts cannot be up at once.
+/// wait for a restart, what stays for an administrator, and the background items macOS still starts from the Trash,
+/// since two alerts cannot be up at once.
struct RemovalFailureAlert: ViewModifier {
/// How many items the alert lists by path. The rest are only counted, to keep the alert short.
static let mostListed = 4
@@ -65,7 +65,7 @@ struct RemovalFailureAlert: ViewModifier {
if Self.needsHelper(outcome) {
Button("Open Peel Settings") { SettingsPane.helper.open(with: openSettings) }
}
- if #available(macOS 27, *), !outcome.appsStartingFromTheTrash.isEmpty {
+ if !outcome.appsStartingFromTheTrash.isEmpty {
Button("Open Login Items & Extensions") { SMAppService.openSystemSettingsLoginItems() }
}
if outcome.leftForAnAdministrator > 0 {
@@ -100,8 +100,8 @@ struct RemovalFailureAlert: ViewModifier {
if !outcome.putBackFailures.isEmpty, outcome.failures.isEmpty {
return Text(verbatim: RestoreFailure.title(stayed: outcome.putBackFailures.count, of: outcome.putBackAsked))
}
- if #available(macOS 27, *), !outcome.appsStartingFromTheTrash.isEmpty, outcome.failures.isEmpty,
- outcome.appsToQuit.isEmpty, outcome.privacy.isEmpty {
+ if !outcome.appsStartingFromTheTrash.isEmpty, outcome.failures.isEmpty, outcome.appsToQuit.isEmpty,
+ outcome.privacy.isEmpty {
return outcome.driversAwaitingARestart.isEmpty
? Text("Empty the Trash to finish.")
: Text("Restart your Mac and empty the Trash to finish.")
@@ -132,9 +132,7 @@ struct RemovalFailureAlert: ViewModifier {
lines += shortened(keptLines(outcome)) + driverLines(outcome) + administratorLines(outcome)
+ shellLines(outcome) { Self.listed($0) { String(inflecting: "^[\($0) more line](inflect: true)") } }
+ appManagementLines(outcome) + shortened(privacyLines(outcome))
- if #available(macOS 27, *) {
- lines += trashLines(outcome, naming: Self.listed)
- }
+ lines += trashLines(outcome, naming: Self.listed)
return lines.joined(separator: "\n\n")
}
@@ -207,9 +205,7 @@ struct RemovalFailureAlert: ViewModifier {
+ keptLines(outcome) + driverLines(outcome) + administratorLines(outcome)
+ shellLines(outcome) { $0.formatted(.list(type: .and)) } + appManagementLines(outcome)
+ privacyLines(outcome)
- if #available(macOS 27, *) {
- lines += trashLines(outcome) { $0.formatted(.list(type: .and)) }
- }
+ lines += trashLines(outcome) { $0.formatted(.list(type: .and)) }
return lines.joined(separator: "\n\n")
}
diff --git a/PeelTests/RemovalFailureAlertTests.swift b/PeelTests/RemovalFailureAlertTests.swift
index ab474df6..eb39e210 100644
--- a/PeelTests/RemovalFailureAlertTests.swift
+++ b/PeelTests/RemovalFailureAlertTests.swift
@@ -78,6 +78,17 @@ struct RemovalFailureAlertTests {
#expect(RemovalFailureAlert.details(for: outcome).components(separatedBy: "\n\n").contains(line ?? ""))
}
+ @Test func saysThatMacOSStartsAMovedAppsItemsFromTheTrashOnEveryMacOS() {
+ let outcome = RemovalOutcome()
+ outcome.report(TrashResult(), startingFromTheTrash: ["Example"])
+ let line = String(
+ localized: "macOS still starts the background items of \("Example") from the Trash each time you log in, until you empty the Trash."
+ )
+
+ #expect(RemovalFailureAlert.message(for: outcome).contains(line))
+ #expect(RemovalFailureAlert.details(for: outcome).contains(line))
+ }
+
@Test func offersTheDetailsWhereTheAlertNamesOnlyTheFirstApps() {
let apps = (1...6).map { index in
InstalledApp(