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 when a disabled background item is still running

Țugui Dragoș64687f9d4934
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 14c6300d..86db6d72 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -36297,6 +36297,218 @@
}
}
},
+ "Disabled, still running" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Vypnuto, stále běží"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Deaktiviert, läuft noch"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Desactivado, aún en ejecución"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Désactivé, toujours en cours d’exécution"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Disabilitato, ancora in esecuzione"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "無効、まだ実行中"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "비활성화됨, 아직 실행 중"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Uitgeschakeld, nog actief"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Wyłączony, nadal uruchomiony"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Desativado, ainda em execução"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dezactivat, încă rulează"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Выключено, но выполняется"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Avaktiverat, fortfarande igång"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Etkin değil, hâlâ çalışıyor"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Вимкнено, але досі виконується"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已停用,但仍在运行"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已停用,仍在執行"
+ }
+ }
+ }
+ },
+ "Disabled, still running · PID %@" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Vypnuto, stále běží · PID %@"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Deaktiviert, läuft noch · PID %@"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Desactivado, aún en ejecución · PID %@"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Désactivé, toujours en cours d’exécution · PID %@"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Disabilitato, ancora in esecuzione · PID %@"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "無効、まだ実行中 · PID %@"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "비활성화됨, 아직 실행 중 · PID %@"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Uitgeschakeld, nog actief · PID %@"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Wyłączony, nadal uruchomiony · PID %@"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Desativado, ainda em execução · PID %@"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dezactivat, încă rulează · PID %@"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Выключено, но выполняется · PID %@"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Avaktiverat, fortfarande igång · PID %@"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Etkin değil, hâlâ çalışıyor · PID %@"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Вимкнено, але досі виконується · PID %@"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已停用,但仍在运行 · PID %@"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "已停用,仍在執行 · PID %@"
+ }
+ }
+ }
+ },
"Disk images" : {
"localizations" : {
"cs" : {
@@ -226265,6 +226477,112 @@
}
}
},
+ "macOS won’t load it again from the next login or restart. If it’s running now, it may keep running until then." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Systém macOS ji od příštího přihlášení nebo restartu znovu nenačte. Pokud teď běží, může běžet až do té doby."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS lädt es ab der nächsten Anmeldung oder dem nächsten Neustart nicht mehr. Wenn es gerade läuft, läuft es möglicherweise bis dahin weiter."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS no volverá a cargarlo a partir del próximo inicio de sesión o reinicio. Si ahora se está ejecutando, puede que siga haciéndolo hasta entonces."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS ne le chargera plus à partir de la prochaine ouverture de session ou du prochain redémarrage. S’il est en cours d’exécution, il pourrait continuer de s’exécuter jusque-là."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dal prossimo login o riavvio, macOS non lo caricherà più. Se ora è in esecuzione, potrebbe continuare a funzionare fino ad allora."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "次回のログインまたは再起動以降、macOSはこれを再び読み込みません。現在実行中の場合は、それまで実行され続けることがあります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "다음 로그인 또는 재시동부터 macOS가 이 항목을 다시 로드하지 않습니다. 지금 실행 중이라면 그때까지 계속 실행될 수 있습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS laadt het niet meer vanaf de volgende keer dat je inlogt of de Mac opnieuw opstart. Als het nu actief is, kan het tot dan actief blijven."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS nie będzie jej wczytywać od następnego logowania lub ponownego uruchomienia. Jeśli jest teraz uruchomiona, może działać do tego czasu."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O macOS não vai carregá-lo novamente a partir do próximo início de sessão ou da próxima reinicialização. Se ele estiver em execução agora, pode continuar em execução até lá."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS nu îl va mai încărca începând cu următorul login sau cu următoarea repornire. Dacă rulează acum, poate continua să ruleze până atunci."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS не будет загружать его снова, начиная со следующего входа в систему или перезагрузки. Если он сейчас выполняется, то может выполняться до этого момента."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS läser inte in det igen från och med nästa inloggning eller omstart. Om det körs nu kan det fortsätta att köras tills dess."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS, bir sonraki oturum açılışından veya yeniden başlatmadan itibaren onu yeniden yüklemez. Şu anda çalışıyorsa o zamana kadar çalışmaya devam edebilir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "macOS більше не завантажуватиме його, починаючи з наступного входу в систему чи перезапуску. Якщо він виконується зараз, то може виконуватися й далі до того часу."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "从下次登录或重新启动起,macOS将不再载入它。如果它现在正在运行,可能会一直运行到那时。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "從下次登入或重新開機起,macOS將不會再載入它。如果它現在正在執行,可能會持續執行到那時。"
+ }
+ }
+ }
+ },
"macOS won’t load this while it is disabled. Enable it first, then start it." : {
"localizations" : {
"cs" : {
diff --git a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift
index 6dc193a0..cee02ddc 100644
--- a/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift
+++ b/Peel/Views/BackgroundItems/BackgroundItemDetailView.swift
@@ -385,6 +385,7 @@ struct BackgroundItemDetailView: View {
Button(item.isDisabled ? "Enable" : "Disable", systemImage: item.isDisabled ? "checkmark.circle" : "minus.circle") {
Task { await backgroundItems.perform(item.isDisabled ? .enable : .disable, on: item) }
}
+ .help(item.isDisabled ? Text(verbatim: "") : Text("macOS won’t load it again from the next login or restart. If it’s running now, it may keep running until then."))
}
}
}
diff --git a/Peel/Views/BackgroundItems/BackgroundItemList.swift b/Peel/Views/BackgroundItems/BackgroundItemList.swift
index 34c1c17f..5d86469d 100644
--- a/Peel/Views/BackgroundItems/BackgroundItemList.swift
+++ b/Peel/Views/BackgroundItems/BackgroundItemList.swift
@@ -226,6 +226,12 @@ extension BackgroundItem {
func stateLook(withProcess: Bool = false) -> (title: Text, symbol: String, tint: Color) {
switch state {
case .unknown: (Text(.unknownBackgroundItemState), "questionmark.circle.dashed", .secondary)
+ // Disabling a job keeps launchd from loading it again, and leaves what runs now running.
+ case .running(let pid) where isDisabled:
+ (
+ withProcess ? Text("Disabled, still running · PID \(String(pid))") : Text("Disabled, still running"),
+ "minus.circle.fill", .orange
+ )
case _ where isDisabled: (Text("Disabled"), "minus.circle.fill", .orange)
case .running(let pid):
(withProcess ? Text("Running · PID \(String(pid))") : Text("Running"), "circle.fill", .green)
diff --git a/PeelTests/BackgroundItemStateLookTests.swift b/PeelTests/BackgroundItemStateLookTests.swift
new file mode 100644
index 00000000..e2efab6a
--- /dev/null
+++ b/PeelTests/BackgroundItemStateLookTests.swift
@@ -0,0 +1,21 @@
+import Foundation
+@testable import Peel
+@testable import PeelCore
+import SwiftUI
+import Testing
+
+struct BackgroundItemStateLookTests {
+ private func job(_ state: BackgroundItem.State, disabled: Bool) -> BackgroundItem {
+ BackgroundItem(
+ label: "org.example.agent", kind: .agent, source: .userLibrary, plistURL: nil,
+ program: "/usr/local/bin/agent", runsAtLoad: true, keepsAlive: true, ownerBundleIdentifier: nil,
+ ownerName: nil, ownerURL: nil, isOrphan: false, state: state, isDisabled: disabled
+ )
+ }
+
+ @Test func aDisabledJobThatStillRunsSaysBoth() {
+ #expect(job(.running(pid: 4_242), disabled: true).stateLook().title == Text("Disabled, still running"))
+ #expect(job(.loaded, disabled: true).stateLook().title == Text("Disabled"))
+ #expect(job(.running(pid: 4_242), disabled: false).stateLook().title == Text("Running"))
+ }
+}