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 why part of the Background Items list may be missing

Țugui Dragoș8e6b1679a282
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 3818e810..0342aa2b 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -227050,6 +227050,112 @@
}
}
},
+ "macOS didn’t answer for some jobs that apps added, so they may be missing here." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Systém macOS neodpověděl ohledně některých úloh, které aplikace přidaly, takže mohou v seznamu chybět."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS hat zu einigen von Apps hinzugefügten Jobs keine Antwort gegeben, daher fehlen sie hier möglicherweise."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS no ha respondido sobre algunas tareas que las apps han añadido, así que puede que aquí falten."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS n’a pas répondu pour certaines tâches que les apps ont ajoutées : elles peuvent donc manquer ici."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS non ha dato risposte su alcuni elementi aggiunti dalle app, quindi qui potrebbero mancare."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "アプリが追加した一部のジョブについてmacOSが応答しなかったため、ここではそれらが欠けている可能性があります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS가 앱에서 추가한 일부 작업에 대해 응답하지 않았으므로 해당 작업이 여기에서 누락되었을 수 있습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS heeft geen antwoord gegeven over sommige taken die door apps zijn toegevoegd, dus die ontbreken hier mogelijk."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS nie odpowiedział w sprawie niektórych zadań dodanych przez aplikacje, więc może ich tu brakować."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O macOS não respondeu sobre algumas tarefas que os apps adicionaram, então elas podem estar faltando aqui."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS nu a răspuns pentru unele sarcini adăugate de aplicații, așa că acestea ar putea lipsi de aici."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS не ответила на запрос о некоторых заданиях, добавленных приложениями, поэтому они могут здесь отсутствовать."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS svarade inte om vissa jobb som appar har lagt till, så de kan saknas här."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS, uygulamaların eklediği bazı işler için yanıt vermedi, bu yüzden bunlar burada eksik olabilir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS не відповіла щодо деяких завдань, доданих програмами, тож їх тут може бракувати."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "对于App添加的某些任务,macOS没有给出回应,因此这里可能缺少这些任务。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "對於App加入的部分工作,macOS沒有回應,因此這裡可能缺少它們。"
+ }
+ }
+ }
+ },
"macOS didn’t list the agents and daemons that apps added, so some may be missing here." : {
"localizations" : {
"cs" : {
@@ -227580,6 +227686,112 @@
}
}
},
+ "macOS didn’t say which jobs are disabled, so Peel can’t tell whether they run, and a disabled one may be missing here." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Systém macOS neuvedl, které úlohy jsou vypnuté, takže Peel nemůže určit, zda běží, a vypnutá úloha může v seznamu chybět."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS hat nicht mitgeteilt, welche Jobs deaktiviert sind, daher kann Peel nicht erkennen, ob sie laufen, und ein deaktivierter Job fehlt hier möglicherweise."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS no ha dicho qué tareas están desactivadas, así que Peel no puede saber si se ejecutan, y puede que aquí falte alguna de las desactivadas."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS n’a pas indiqué quelles tâches sont désactivées : Peel ne peut donc pas savoir si elles s’exécutent, et une tâche désactivée peut manquer ici."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS non ha detto quali elementi sono disabilitati, quindi Peel non può sapere se sono in esecuzione, e qui potrebbe mancare un elemento disabilitato."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "どのジョブが無効になっているかをmacOSが報告しなかったため、それらが実行されるかどうかPeelには判断できません。また、無効になっているジョブは、ここでは欠けている可能性があります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS가 어떤 작업이 비활성화되어 있는지 알려 주지 않았으므로 Peel은 작업이 실행되는지 알 수 없으며, 비활성화된 작업이 여기에서 누락되었을 수 있습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS heeft niet gemeld welke taken zijn uitgeschakeld, dus Peel kan niet zeggen of ze actief zijn, en een uitgeschakelde taak ontbreekt hier mogelijk."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS nie podał, które zadania są wyłączone, więc Peel nie może określić, czy są uruchomione, a wyłączonego zadania może tu brakować."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O macOS não disse quais tarefas estão desativadas, então o Peel não sabe dizer se elas são executadas, e uma tarefa desativada pode estar faltando aqui."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS nu a spus ce sarcini sunt dezactivate, așa că Peel nu poate ști dacă acestea rulează, iar una dezactivată ar putea lipsi de aici."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS не сообщила, какие задания выключены, поэтому Peel не может сказать, выполняются ли они, а выключенное задание может здесь отсутствовать."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS sa inte vilka jobb som är avaktiverade, så Peel kan inte avgöra om de körs, och ett avaktiverat jobb kan saknas här."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS hangi işlerin etkin olmadığını söylemedi, bu yüzden Peel bunların çalışıp çalışmadığını bilemiyor ve etkin olmayan bir iş burada eksik olabilir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS не повідомила, які завдання вимкнено, тож Peel не може визначити, чи вони виконуються, а вимкнених завдань тут може бракувати."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS没有说明哪些任务已停用,因此Peel无法判断它们是否在运行,而且这里可能缺少已停用的任务。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS沒有說明哪些工作已停用,因此Peel無法判斷它們是否會執行,而且這裡可能缺少已停用的工作。"
+ }
+ }
+ }
+ },
"macOS didn’t say which system extensions are on this Mac, so none are listed here." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift b/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift
index f4f083e5..e1c8fc8b 100644
--- a/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/IntelInspector.swift
@@ -266,7 +266,7 @@ public enum IntelInspector {
},
unreadable: unread,
needsFullDiskAccess: unread.contains { FullDiskAccess.canList($0) == .missing },
- unansweredJobs: backgroundItems.unanswered
+ unansweredJobs: backgroundItems.unanswered.kinds
)
}
diff --git a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift
index f1af9207..e64cbda0 100644
--- a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift
+++ b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift
@@ -6,16 +6,41 @@ public enum BackgroundItems {
static let serviceManagement = "com.apple.xpc.ServiceManagement"
private static let concurrentDetailQueries = 8
+ /// What `launchctl` answered about in a form Peel cannot read, kind by kind, so some jobs may be missing.
+ public struct Unanswered: Sendable, Hashable {
+ /// The kinds whose loaded jobs couldn't be listed: the jobs apps added, known only from that list, may be
+ /// missing.
+ public var lists: Set<BackgroundItem.Kind> = []
+ /// The kinds whose disabled jobs couldn't be read: the state of each job isn't known, and a disabled job that
+ /// isn't loaded may be missing.
+ public var overrides: Set<BackgroundItem.Kind> = []
+ /// The kinds of the jobs an app added whose own answer couldn't be read, so their rows may be missing.
+ public var jobs: Set<BackgroundItem.Kind> = []
+
+ public init(
+ lists: Set<BackgroundItem.Kind> = [], overrides: Set<BackgroundItem.Kind> = [],
+ jobs: Set<BackgroundItem.Kind> = []
+ ) {
+ self.lists = lists
+ self.overrides = overrides
+ self.jobs = jobs
+ }
+
+ public var isEmpty: Bool { kinds.isEmpty }
+
+ /// Every kind some of whose jobs may be missing, for whatever reason.
+ public var kinds: Set<BackgroundItem.Kind> { lists.union(overrides).union(jobs) }
+ }
+
public struct Scan: Sendable {
public let items: [BackgroundItem]
- /// The kinds that may be missing jobs, because `launchctl` answered about them in a form Peel cannot read.
- public let unanswered: Set<BackgroundItem.Kind>
+ public let unanswered: Unanswered
/// The folders that kept Peel from listing a folder of job files, so a job whose file is there and which isn't
/// loaded is missing.
public let unreadableFolders: [URL]
public init(
- items: [BackgroundItem] = [], unanswered: Set<BackgroundItem.Kind> = [], unreadableFolders: [URL] = []
+ items: [BackgroundItem] = [], unanswered: Unanswered = Unanswered(), unreadableFolders: [URL] = []
) {
self.items = items
self.unanswered = unanswered
@@ -157,18 +182,16 @@ public enum BackgroundItems {
return rows + others
}
- /// The items among what `launchctl` said of each undeclared job, and the kinds some of whose jobs may be missing:
- /// those `loaded` could not read, and those of a job whose answer could not be read.
- static func merged(
- _ found: [Undeclared], loaded: Loaded
- ) -> (items: [BackgroundItem], unanswered: Set<BackgroundItem.Kind>) {
+ /// The items among what `launchctl` said of each undeclared job, and what was not answered: what `loaded` could
+ /// not read, and the kind of each job whose answer could not be read.
+ static func merged(_ found: [Undeclared], loaded: Loaded) -> (items: [BackgroundItem], unanswered: Unanswered) {
var items: [BackgroundItem] = []
var unanswered = loaded.unanswered
for result in found {
switch result {
case .item(let item): items.append(item)
case .nothing: break
- case .unreadable(let kind): unanswered.insert(kind)
+ case .unreadable(let kind): unanswered.jobs.insert(kind)
}
}
return (items, unanswered)
@@ -264,13 +287,14 @@ public enum BackgroundItems {
overrides(kind)?[label]
}
- /// The kinds whose loaded jobs or overrides could not be read, so that jobs an app registered, which are
- /// known only from them, may be missing.
- var unanswered: Set<BackgroundItem.Kind> {
- var kinds: Set<BackgroundItem.Kind> = []
- if user == nil || userDisabled == nil || inTheUserDomain == nil { kinds.insert(.agent) }
- if system == nil || systemDisabled == nil { kinds.insert(.daemon) }
- return kinds
+ /// What could not be read of the loaded jobs and of the disabled ones, kind by kind.
+ var unanswered: Unanswered {
+ var unanswered = Unanswered()
+ if user == nil || inTheUserDomain == nil { unanswered.lists.insert(.agent) }
+ if system == nil { unanswered.lists.insert(.daemon) }
+ if userDisabled == nil { unanswered.overrides.insert(.agent) }
+ if systemDisabled == nil { unanswered.overrides.insert(.daemon) }
+ return unanswered
}
private func overrides(_ kind: BackgroundItem.Kind) -> [String: Bool]? {
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
index 44acab69..81e7209f 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/BackgroundItemActionsTests.swift
@@ -220,7 +220,7 @@ struct BackgroundItemActionsTests {
#expect(undeclared.map(\.target) == ["user/501/org.example.background", "gui/501/org.example.window"])
guard case .item(let item) = found else { throw CocoaError(.featureUnsupported) }
#expect(item.loadsInTheBackgroundSession)
- #expect(BackgroundItems.Loaded(user: [:], inTheUserDomain: nil).unanswered == [.agent])
+ #expect(BackgroundItems.Loaded(user: [:], inTheUserDomain: nil).unanswered.lists == [.agent])
}
@Test func aJobWhoseFileIsGoneSaysSo() throws {
@@ -830,13 +830,17 @@ struct DeclaredBackgroundItemsTests {
#expect(found(.unreadable, .daemon) == .unreadable(.daemon))
#expect(found(.gone, .agent) == .nothing)
#expect(BackgroundItems.Loaded().unanswered.isEmpty)
- #expect(BackgroundItems.Loaded(user: nil).unanswered == [.agent])
- #expect(BackgroundItems.Loaded(userDisabled: nil).unanswered == [.agent])
- #expect(BackgroundItems.Loaded(system: nil, systemDisabled: nil).unanswered == [.daemon])
+ #expect(BackgroundItems.Loaded(user: nil).unanswered == .init(lists: [.agent]))
+ #expect(BackgroundItems.Loaded(userDisabled: nil).unanswered == .init(overrides: [.agent]))
+ #expect(
+ BackgroundItems.Loaded(system: nil, systemDisabled: nil).unanswered
+ == .init(lists: [.daemon], overrides: [.daemon])
+ )
let merged = BackgroundItems.merged([found(.gone, .agent), found(.unreadable, .daemon)], loaded: .init())
#expect(merged.items.isEmpty)
- #expect(merged.unanswered == [.daemon])
- #expect(BackgroundItems.merged([], loaded: .init(user: nil)).unanswered == [.agent])
+ #expect(merged.unanswered == .init(jobs: [.daemon]))
+ #expect(merged.unanswered.kinds == [.daemon])
+ #expect(BackgroundItems.merged([], loaded: .init(user: nil)).unanswered == .init(lists: [.agent]))
}
/// A job an app registered is known only while it is loaded, so after Disable and a restart it would leave the
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift
index c91ebfe1..8a9db7db 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/IntelInspectorTests.swift
@@ -651,7 +651,7 @@ struct IntelInspectorTests {
InstalledApp(url: universal, bundleIdentifier: "org.example.universal", name: "Universal", architectures: [.x86_64, .arm64]),
InstalledApp(url: closedApp, bundleIdentifier: "org.example.closed", name: "Closed", architectures: []),
],
- backgroundItems: BackgroundItems.Scan(items: [job], unanswered: [.daemon]),
+ backgroundItems: BackgroundItems.Scan(items: [job], unanswered: .init(lists: [.daemon])),
exclusions: .none,
environment: environment(in: directory),
measure: { _ in 1 }
diff --git a/Peel/Model/BackgroundItemLibrary.swift b/Peel/Model/BackgroundItemLibrary.swift
index 59103a38..0a9c9e2e 100644
--- a/Peel/Model/BackgroundItemLibrary.swift
+++ b/Peel/Model/BackgroundItemLibrary.swift
@@ -7,7 +7,7 @@ import SwiftUI
final class BackgroundItemLibrary {
private(set) var items: [BackgroundItem]?
/// The kinds of job some of which may be missing, because macOS answered about them in a form Peel cannot read.
- private(set) var unanswered: Set<BackgroundItem.Kind> = []
+ private(set) var unanswered = BackgroundItems.Unanswered()
/// The folders that kept Peel from listing a folder of job files.
private(set) var unreadableFolders: [URL] = []
/// The scan this page runs, which a newer one or the Stop button ends.
@@ -179,7 +179,13 @@ final class BackgroundItemLibrary {
extension BackgroundItemLibrary {
/// What the page says when some jobs may be missing, a paragraph for each reason, or nil when none is.
var missingNote: String? {
- let parts = (unanswered.missingJobsNote.map { [String(localized: $0)] } ?? [])
+ let parts = (unanswered.lists.missingJobsNote.map { [String(localized: $0)] } ?? [])
+ + (unanswered.overrides.isEmpty ? [] : [
+ String(localized: "macOS didn’t say which jobs are disabled, so Peel can’t tell whether they run, and a disabled one may be missing here."),
+ ])
+ + (unanswered.jobs.isEmpty ? [] : [
+ String(localized: "macOS didn’t answer for some jobs that apps added, so they may be missing here."),
+ ])
+ unreadableFolders.map {
String(localized: "Peel can’t look in \($0.abbreviatedPath), so a job whose file is there shows here only while macOS has it loaded.")
}