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
Say under each switch when Peel can't send its notifications
Țugui Dragoșa4a5a50e3501
diff --git a/GUIDE.md b/GUIDE.mdindex 851e8c7b..a33d40e9 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -367,7 +367,7 @@ and takes you straight to the right place in System Settings, or, for the comman| Full Disk Access | Look inside the Trash and the private folders where apps keep their data. Without it, Peel can't find everything an app leaves behind. Watch the Trash, the iCloud Drive page, and the list of iPhone and iPad backups need it too. || App Management | Move another developer's app to the Trash. Without it, Peel can still clear an app's files, but macOS may refuse to move the app itself. || Helper | Move to the Trash, and put back, what sits in folders only an administrator can change, such as an app's leftovers, the caches and logs Space lists for every account, and an installer package's files and receipt, and start, stop, enable, or disable other developers' background items that run as root. It answers administrators only. macOS asks you to approve it once in Login Items & Extensions, and an update of Peel brings its new helper with it. |-| Notifications (optional) | Tell you when your apps have updates, when Homebrew finishes an upgrade or runs into a problem, when your disk is almost full if you turn that warning on, and, with Watch the Trash on, when you move an app to the Trash yourself. |+| Notifications (optional) | Tell you when your apps have updates, when Homebrew finishes an upgrade or runs into a problem, when your disk is almost full if you turn that warning on, and, with Watch the Trash on, when you move an app to the Trash yourself. While they're off, Settings > General says so under those two switches. || Folders macOS asks about | Without Full Disk Access, macOS asks the first time Peel looks in Desktop, Documents, or Downloads for installers, duplicates, and what builds left, or at your cloud folders to measure them. On macOS 26 it also asks before Peel looks inside another app's data for what it would leave behind; on macOS 27 it refuses without asking, and Peel says which folders it couldn't read. || Finder Extension (optional) | Add Uninstall with Peel to the menu you get when you Control-click an app in Finder. || Open at Login (optional) | Start Peel when you log in. With Show in Menu Bar on, it keeps running after you close its window, so Watch the Trash keeps working. |diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex b7111754..295c6c7a 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -114836,6 +114836,218 @@}}},+ "Peel isn’t allowed to send notifications, so it can’t offer to remove the files an app left behind." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nemá povoleno posílat oznámení, takže nemůže nabídnout odstranění souborů, které po aplikaci zůstaly."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel darf keine Mitteilungen senden und kann daher nicht anbieten, die Dateien zu entfernen, die eine App hinterlassen hat."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel no tiene permiso para enviar notificaciones, así que no puede ofrecerte eliminar los archivos que ha dejado una app."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel n’est pas autorisé à envoyer des notifications : il ne peut donc pas proposer de supprimer les fichiers qu’une app a laissés derrière elle."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel non è autorizzato a inviare notifiche, quindi non può proporti di rimuovere i file che un’app si è lasciata dietro."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peelは通知の送信を許可されていないため、アプリが残したファイルを取り除くよう提案できません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel이 알림을 보내도록 허용되어 있지 않으므로 앱이 남긴 파일의 제거를 제안할 수 없습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel mag geen meldingen sturen, dus Peel kan niet aanbieden om de bestanden te verwijderen die een app heeft achtergelaten."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nie ma pozwolenia na wysyłanie powiadomień, więc nie może zaproponować przeniesienia do Kosza plików pozostawionych przez aplikację."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Peel não tem permissão para enviar notificações, então não pode oferecer a remoção dos arquivos que um app deixou para trás."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nu are permisiunea să trimită notificări, așa că nu se poate oferi să elimine fișierele lăsate în urmă de o aplicație."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не разрешено отправлять уведомления, поэтому он не может предложить удалить файлы, оставшиеся после приложения."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel får inte skicka notiser, så Peel kan inte erbjuda sig att ta bort filerna som en app har lämnat kvar."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel’in bildirim göndermesine izin verilmiyor, bu yüzden bir uygulamanın geride bıraktığı dosyaları kaldırmayı öneremez."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не дозволено надсилати сповіщення, тож вона не може запропонувати вилучити файли, які програма залишила по собі."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel未获准发送通知,因此无法在App留下文件时提示你移除它们。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel未獲允許傳送通知,因此無法提議移除App留下的檔案。"+ }+ }+ }+ },+ "Peel isn’t allowed to send notifications, so it can’t warn you when the disk is almost full." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nemá povoleno posílat oznámení, takže vás nemůže upozornit, když je disk téměř plný."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel darf keine Mitteilungen senden und kann dich daher nicht warnen, wenn das Volume fast voll ist."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel no tiene permiso para enviar notificaciones, así que no puede avisarte cuando el disco esté casi lleno."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel n’est pas autorisé à envoyer des notifications : il ne peut donc pas vous avertir lorsque le disque est presque plein."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel non è autorizzato a inviare notifiche, quindi non può avvisarti quando il disco è quasi pieno."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peelは通知の送信を許可されていないため、ディスクの空きが少なくなっても警告できません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel이 알림을 보내도록 허용되어 있지 않으므로 디스크가 거의 가득 찼을 때 경고할 수 없습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel mag geen meldingen sturen, dus Peel kan je niet waarschuwen als de schijf bijna vol is."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nie ma pozwolenia na wysyłanie powiadomień, więc nie może Cię ostrzec, gdy dysk będzie prawie pełny."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "O Peel não tem permissão para enviar notificações, então não pode avisar você quando o disco estiver quase cheio."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel nu are permisiunea să trimită notificări, așa că nu vă poate avertiza când discul este aproape plin."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не разрешено отправлять уведомления, поэтому он не может предупредить Вас, когда диск почти заполнен."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel får inte skicka notiser, så Peel kan inte varna dig när skivan nästan är full."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel’in bildirim göndermesine izin verilmiyor, bu yüzden disk neredeyse dolduğunda sizi uyaramaz."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel не дозволено надсилати сповіщення, тож вона не може попередити вас, коли диск майже заповнений."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel未获准发送通知,因此无法在磁盘快满时提醒你。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Peel未獲允許傳送通知,因此無法在磁碟快滿時提醒你。"+ }+ }+ }+ },"Peel isn’t sure only %@ used this. Check it before you remove it." : {"localizations" : {"cs" : {diff --git a/Peel/Model/HomeModel.swift b/Peel/Model/HomeModel.swiftindex e3ce148b..54c96b08 100644--- a/Peel/Model/HomeModel.swift+++ b/Peel/Model/HomeModel.swift@@ -251,9 +251,9 @@ final class HomeModel {openNotificationSettings()return}- _ = try? await UNUserNotificationCenter.current().requestAuthorization(options: [.alert])- notificationStatus = await UNUserNotificationCenter.current().notificationSettings().authorizationStatus- found[.notifications] = notificationStatus == .authorized ? .on : .off+ await PeelNotifications.requestAuthorization()+ // Through `refresh`, so a read already running reads again rather than showing what it found before.+ await refresh()}func openFinderExtensionSettings() {diff --git a/Peel/Model/PeelNotifications.swift b/Peel/Model/PeelNotifications.swiftindex ff3f2a51..9954795c 100644--- a/Peel/Model/PeelNotifications.swift+++ b/Peel/Model/PeelNotifications.swift@@ -13,10 +13,17 @@ final class PeelNotifications: NSObject, UNUserNotificationCenterDelegate {UNUserNotificationCenter.current().delegate = self}- func requestAuthorization() async {+ /// Asks macOS to let Peel send notifications. macOS asks the person only the first time, and keeps the answer.+ static func requestAuthorization() async {_ = try? await UNUserNotificationCenter.current().requestAuthorization(options: [.alert])}+ /// Whether the person refused Peel's notifications. An answer not given yet is no refusal: Peel asks when a+ /// switch that needs them is turned on.+ nonisolated static func areTurnedOff(_ status: UNAuthorizationStatus) -> Bool {+ status == .denied+ }+func notify(applicationTrashed url: URL) {let content = UNMutableNotificationContent()let name = AppInspector.displayName(of: url)diff --git a/Peel/PeelApp.swift b/Peel/PeelApp.swiftindex fb939d0f..f30ac19e 100644--- a/Peel/PeelApp.swift+++ b/Peel/PeelApp.swift@@ -267,6 +267,13 @@ struct PeelApp: App {}}+ /// Asks for notifications, the only way Watch the Trash and the disk warning reach the person, and reads the+ /// answer again, since Home and Settings say when they are off.+ private func askForNotifications() async {+ await PeelNotifications.requestAuthorization()+ await home.refresh()+ }+private func checkFreeSpace() async {let storage = await LowDiskSpace.storage()let defaults = UserDefaults.standard@@ -429,7 +436,7 @@ struct PeelApp: App {.onChange(of: watchesTrash) { _, isWatching inif isWatching {trashMonitor.start()- Task { await notifications.requestAuthorization() }+ Task { await askForNotifications() }} else {trashMonitor.stop()}@@ -444,7 +451,7 @@ struct PeelApp: App {UserDefaults.standard.removeObject(forKey: SettingsKey.toldDiskIsNearlyFull)guard warns else { return }Task {- await notifications.requestAuthorization()+ await askForNotifications()await checkFreeSpace()}}diff --git a/Peel/Views/Settings/SettingsView.swift b/Peel/Views/Settings/SettingsView.swiftindex 87b120d4..94a33b8e 100644--- a/Peel/Views/Settings/SettingsView.swift+++ b/Peel/Views/Settings/SettingsView.swift@@ -285,8 +285,14 @@ private struct GeneralSettingsView: View {} else if watchesTrash, trashMonitor.status == .unavailable {StatusLabel(title: Text("Peel isn’t watching the Trash right now. It tries again each time you come back to Peel."))}+ if watchesTrash, PeelNotifications.areTurnedOff(home.notificationStatus) {+ notificationsOff(Text("Peel isn’t allowed to send notifications, so it can’t offer to remove the files an app left behind."))+ }toggle("Warn when the disk is almost full", isOn: $warnsWhenDiskIsNearlyFull,"When less than a tenth of the disk your home folder is on is available, Peel sends a notification that opens Space. It checks only while it is running.")+ if warnsWhenDiskIsNearlyFull, PeelNotifications.areTurnedOff(home.notificationStatus) {+ notificationsOff(Text("Peel isn’t allowed to send notifications, so it can’t warn you when the disk is almost full."))+ }// A binding, not `onChange`: macOS's own answer landing in the model must not register again.toggle("Open Peel at login", isOn: Binding(get: { loginItem.isOn }, set: { loginItem.set(on: $0) }),"Starts Peel when you log in. “Watch the Trash” works only while Peel is running.")@@ -569,6 +575,16 @@ extension GeneralSettingsView {titled(title, detail)}}++ fileprivate func notificationsOff(_ title: Text) -> some View {+ HStack {+ StatusLabel(title: title, systemImage: "bell.slash")+ Spacer()+ Button("Open System Settings") {+ home.openNotificationSettings()+ }+ }+ }}extension GeneralSettingsView {diff --git a/PeelTests/NotificationNeedTests.swift b/PeelTests/NotificationNeedTests.swiftnew file mode 100644index 00000000..dd13bfcb--- /dev/null+++ b/PeelTests/NotificationNeedTests.swift@@ -0,0 +1,12 @@+@testable import Peel+import Testing+import UserNotifications++struct NotificationNeedTests {+ @Test func onlyARefusalCountsAsTurnedOff() {+ #expect(PeelNotifications.areTurnedOff(.denied))+ #expect(!PeelNotifications.areTurnedOff(.authorized))+ #expect(!PeelNotifications.areTurnedOff(.provisional))+ #expect(!PeelNotifications.areTurnedOff(.notDetermined))+ }+}