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 Quit Apps when several apps must quit before Homebrew or a receipt

Țugui Dragoș7e5318b87256
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3fdc63ed..dc7ca508 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -552,6 +552,7 @@ its changes the way [Keep a Changelog](https://keepachangelog.com/) suggests.
#### Homebrew
+- With several apps to quit before an upgrade, the button says Quit Apps, since some languages say "the app" there.
- Peel asks Homebrew for its prefix and its Cellar, so the formulae you excluded are always kept.
- Uninstall and Upgrade wait until Homebrew's apps are known, and the copied commands keep the excluded formulae.
- Check Health runs Homebrew's whole check, the vulnerability scan says when it checked the current formula, and the
diff --git a/Peel/Model/QuitBeforeRemoving.swift b/Peel/Model/QuitBeforeRemoving.swift
index 798c036d..595e117d 100644
--- a/Peel/Model/QuitBeforeRemoving.swift
+++ b/Peel/Model/QuitBeforeRemoving.swift
@@ -27,8 +27,17 @@ final class QuitBeforeRemoving {
/// The names of what still runs, for the alerts.
var names: String {
- let open = running.filter { !ended.contains($0.processIdentifier) }
- return Self.named(open.map { $0.localizedName ?? $0.bundleIdentifier ?? "" })
+ Self.named(openNames)
+ }
+
+ /// Whether the alerts name more than one app, which is what the button that quits them goes by: "Quit %@" is
+ /// written for one in the languages that say "the app".
+ var namesSeveral: Bool {
+ Set(openNames).count > 1
+ }
+
+ private var openNames: [String] {
+ running.filter { !ended.contains($0.processIdentifier) }.map { $0.localizedName ?? $0.bundleIdentifier ?? "" }
}
/// Each name once, and the first few of many, as an alert lists them.
diff --git a/Peel/Views/Homebrew/QuitBeforeHomebrewAlert.swift b/Peel/Views/Homebrew/QuitBeforeHomebrewAlert.swift
index b476d313..7507fb8d 100644
--- a/Peel/Views/Homebrew/QuitBeforeHomebrewAlert.swift
+++ b/Peel/Views/Homebrew/QuitBeforeHomebrewAlert.swift
@@ -8,7 +8,7 @@ extension View {
upgrading ? Text("Quit \(quitting.names) before upgrading.") : Text("Quit \(quitting.names) before uninstalling."),
isPresented: Bindable(quitting).isAsking
) {
- Button("Quit \(quitting.names)") { quitting.quit() }
+ Button(quitting.namesSeveral ? "Quit Apps" : "Quit \(quitting.names)") { quitting.quit() }
Button("Cancel", role: .cancel) { quitting.giveUp() }
} message: {
upgrading
diff --git a/Peel/Views/Packages/PackageDetailView.swift b/Peel/Views/Packages/PackageDetailView.swift
index d67c8e4f..2d067c9a 100644
--- a/Peel/Views/Packages/PackageDetailView.swift
+++ b/Peel/Views/Packages/PackageDetailView.swift
@@ -160,7 +160,7 @@ struct PackageDetailView: View {
}
.forgetReceiptDialog(for: $receiptToForget, forget: packages.forget)
.alert(Text("Quit \(quitting.names) before removing it."), isPresented: Bindable(quitting).isAsking) {
- Button("Quit \(quitting.names)") { quitting.quit() }
+ Button(quitting.namesSeveral ? "Quit Apps" : "Quit \(quitting.names)") { quitting.quit() }
Button("Cancel", role: .cancel) { quitting.giveUp() }
}
.forceQuitOffer(quitting)