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.

Offer Remove and say a job runs from the Trash on macOS 26 too

Țugui Dragoș253d1dcac25d
diff --git a/GUIDE.md b/GUIDE.md
index 4ec71b15..acefa93f 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -287,7 +287,7 @@ and how many items the others hold.
- **Background Items:** launch agents and daemons, and the app that added each one, to start or stop, enable or
disable, show in Finder, or move to the Trash, through Peel's helper for those that run as root. One whose program
- is gone, or whose command looks unusual, says so. On macOS 27, Remove takes out a job a deleted app left loaded,
+ is gone, or whose command looks unusual, says so. Remove takes out a job a deleted app left loaded,
and an item whose app is in the Trash says that macOS starts it from there each time you log in, until you empty
the Trash. A job an app gave launchd itself, such as an update's installer, says so. Apps set to open at login are
in System Settings > General > Login Items & Extensions, not here.
diff --git a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swift b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swift
index 05743468..635942e8 100644
--- a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swift
+++ b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItem.swift
@@ -164,14 +164,14 @@ public struct BackgroundItem: Sendable, Hashable, Identifiable {
public var offersControls: Bool {
guard canBeControlled, state != .unknown, !isNamedByItsFile, !anotherFileIsLoaded else { return false }
if canOnlyBeStopped || isRunning { return true }
- if #available(macOS 27, *), isLeftByAGoneApp { return true }
+ if isLeftByAGoneApp { return true }
return !isSeenOnlyWhileLoaded || isDisabled || mayBeDisabled
}
public enum StartOrStop: Sendable {
case start
case stop
- /// Stop under the name macOS 27's page gives it for a job its gone app left loaded.
+ /// Stop under the name the page gives it for a job its gone app left loaded.
case remove
}
@@ -180,16 +180,14 @@ public struct BackgroundItem: Sendable, Hashable, Identifiable {
public var startOrStop: StartOrStop? {
guard offersControls else { return nil }
if canOnlyBeStopped { return .stop }
- if #available(macOS 27, *), isLeftByAGoneApp { return .remove }
+ if isLeftByAGoneApp { return .remove }
if isSeenOnlyWhileLoaded { return isRunning ? .stop : nil }
return state == .notLoaded ? .start : .stop
}
- /// Enable and Disable, which a job Peel can only stop, and on macOS 27 one its gone app left, don't have.
+ /// Enable and Disable, which a job Peel can only stop, and one its gone app left, don't have.
public var offersEnableOrDisable: Bool {
- guard offersControls, !canOnlyBeStopped, isDisabled || mayBeDisabled else { return false }
- if #available(macOS 27, *), isLeftByAGoneApp { return false }
- return true
+ offersControls && !canOnlyBeStopped && !isLeftByAGoneApp && (isDisabled || mayBeDisabled)
}
/// Whether the helper would let Peel do more with the job than it can without it: a control the page offers, or the
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
index fc126409..18cb8426 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
@@ -31,11 +31,7 @@ struct BackgroundItemActionsTests {
var leftByAGoneApp = daemon(source: .app, plist: nil)
leftByAGoneApp.isManagedByServiceManagement = true
- if #available(macOS 27, *) {
- #expect(leftByAGoneApp.waitsForTheHelper)
- } else {
- #expect(!leftByAGoneApp.waitsForTheHelper)
- }
+ #expect(leftByAGoneApp.waitsForTheHelper)
var excluded = daemon()
excluded.isExcluded = true
@@ -161,6 +157,13 @@ struct BackgroundItemActionsTests {
#expect(elsewhere.startOrStop == .stop)
#expect(!elsewhere.offersEnableOrDisable)
+ var left = item(state: .loaded, plist: nil)
+ left.source = .app
+ left.isManagedByServiceManagement = true
+ #expect(left.isLeftByAGoneApp)
+ #expect(left.startOrStop == .remove)
+ #expect(!left.offersEnableOrDisable)
+
var excluded = item(state: .running(pid: 42), plist: file)
excluded.isExcluded = true
#expect(excluded.startOrStop == nil)
diff --git a/Peel/Model/BackgroundItemLibrary.swift b/Peel/Model/BackgroundItemLibrary.swift
index 7b294ded..b28aec21 100644
--- a/Peel/Model/BackgroundItemLibrary.swift
+++ b/Peel/Model/BackgroundItemLibrary.swift
@@ -125,7 +125,7 @@ final class BackgroundItemLibrary {
enum Action {
case start
case stop
- /// Stop under the name macOS 27's page gives it for a job its gone app left loaded.
+ /// Stop under the name the page gives it for a job its gone app left loaded.
case remove
case enable
case disable
diff --git a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift
index 6818155e..19e393a0 100644
--- a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift
+++ b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift
@@ -34,7 +34,7 @@ struct BackgroundItemDetailView: View {
LabeledContent("Added by") {
VStack(alignment: .trailing, spacing: 1) {
Text(verbatim: item.ownerName ?? library.name(forReference: owner))
- if #available(macOS 27, *), item.runsFromTheTrash {
+ if item.runsFromTheTrash {
Text("In the Trash")
.font(.caption)
.foregroundStyle(.secondary)
@@ -387,7 +387,7 @@ struct BackgroundItemDetailView: View {
detail: Text("The program it starts is gone, and no installed app claims it.")
)
}
- if #available(macOS 27, *), item.runsFromTheTrash {
+ if item.runsFromTheTrash {
NoteBadge(
title: Text("Runs from the Trash"), systemImage: "trash", tint: .orange,
name: String(localized: "Runs from the Trash"),
diff --git a/Peel/Views/BackgroundItems/BackgroundItemList.swift b/Peel/Views/BackgroundItems/BackgroundItemList.swift
index e6c2c3f6..ea80eb6f 100644
--- a/Peel/Views/BackgroundItems/BackgroundItemList.swift
+++ b/Peel/Views/BackgroundItems/BackgroundItemList.swift
@@ -226,7 +226,7 @@ private struct BackgroundItemRow: View {
.font(.caption)
.foregroundStyle(.secondary)
.lineLimit(1)
- } else if #available(macOS 27, *), item.runsFromTheTrash {
+ } else if item.runsFromTheTrash {
StatusLabel(title: Text("Runs from the Trash"))
.font(.caption)
.foregroundStyle(.secondary)
diff --git a/SAFETY.md b/SAFETY.md
index 2ebb0f5a..6a4968b7 100644
--- a/SAFETY.md
+++ b/SAFETY.md
@@ -270,7 +270,7 @@ Some of what Peel does is not a move to the Trash. Each is here with how it is u
| Remove Downloads frees this Mac's copy of a file in iCloud Drive | The file stays in iCloud and downloads again when you open it |
| Build Artifacts leaves a project's build folders out of Time Machine, when you ask it to | The same checkbox takes the mark off, and leaves alone a mark a tool put on what Peel never marks |
| A background item is stopped, started, disabled, or enabled | The same buttons in Background Items; a disabled item stays disabled after a restart until you enable it |
-| A background job a deleted app left loaded is removed (`launchctl bootout`), on macOS 27 | Nothing to bring back: its app, and what the job ran, are gone |
+| A background job a deleted app left loaded is removed (`launchctl bootout`) | Nothing to bring back: its app, and what the job ran, are gone |
| A tweak changes a setting of macOS, and the Dock, Finder, Control Center, or the window manager restarts to read it (`killall`, which for Finder stops anything it is copying) | Turning the tweak off puts back what was there before, or leaves it to macOS. Turn All Off puts back only what Peel changed, and leaves what you set yourself as it is |
| The Terminal page adds Peel's profiles and options to Terminal, makes `~/.hushlogin`, writes Peel's shell and ssh files, and changes Git's settings | Put Back, turning the setting off, or Turn All Off, as [Terminal's settings](#terminals-settings) says |