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.

Put several apps' two options side by side

Țugui Dragoș5bef2fbd18a5
diff --git a/Peel/Views/DockTileRow.swift b/Peel/Views/DockTileRow.swift
index d2ae1ff3..395ba7eb 100644
--- a/Peel/Views/DockTileRow.swift
+++ b/Peel/Views/DockTileRow.swift
@@ -5,6 +5,20 @@ import SwiftUI
struct DockTileRow: View {
@Binding var isOn: Bool
+ var body: some View {
+ HStack(spacing: 5) {
+ DockTileOption(isOn: $isOn)
+ Spacer(minLength: 0)
+ }
+ .padding(.vertical, 8)
+ .listRowSeparator(.hidden)
+ }
+}
+
+/// The checkbox and its circled i, for a row of their own or beside another option.
+struct DockTileOption: View {
+ @Binding var isOn: Bool
+
var body: some View {
HStack(spacing: 5) {
Toggle(isOn: $isOn) {
@@ -15,9 +29,6 @@ struct DockTileRow: View {
name: String(localized: "Remove from the Dock"),
detail: Text("The Dock keeps an app’s icon after the app is gone, as a question mark. If this is selected, Peel takes the icon out once the app is in the Trash, and the Dock restarts. Putting the app back from History puts its icon back where it was.")
)
- Spacer(minLength: 0)
}
- .padding(.vertical, 8)
- .listRowSeparator(.hidden)
}
}
diff --git a/Peel/Views/MultipleAppsView.swift b/Peel/Views/MultipleAppsView.swift
index ccbe2fda..e668e0e8 100644
--- a/Peel/Views/MultipleAppsView.swift
+++ b/Peel/Views/MultipleAppsView.swift
@@ -408,11 +408,20 @@ private struct BulkRemovalOptions: View {
let plan: BulkRemovalPlan
var body: some View {
- if !PrivacyReset.apps(among: plan.apps, moving: plan.selectable).isEmpty {
- PrivacyResetRow(isOn: Bindable(plan).resetsPrivacy, detail: PrivacyResetRow.beforeTheMove)
- }
- if !plan.appsInTheDock.isDisjoint(with: plan.selectable) {
- DockTileRow(isOn: Bindable(plan).removesDockTiles)
+ let resets = !PrivacyReset.apps(among: plan.apps, moving: plan.selectable).isEmpty
+ let removesTiles = !plan.appsInTheDock.isDisjoint(with: plan.selectable)
+ if resets || removesTiles {
+ // Side by side while they fit, and the second on a line of its own when they don't.
+ FlowLayout(spacing: 24) {
+ if resets {
+ PrivacyResetOption(isOn: Bindable(plan).resetsPrivacy, detail: PrivacyResetRow.beforeTheMove)
+ }
+ if removesTiles {
+ DockTileOption(isOn: Bindable(plan).removesDockTiles)
+ }
+ }
+ .padding(.vertical, 8)
+ .listRowSeparator(.hidden)
}
}
}
diff --git a/Peel/Views/PrivacyResetRow.swift b/Peel/Views/PrivacyResetRow.swift
index 73e52517..ccf1b802 100644
--- a/Peel/Views/PrivacyResetRow.swift
+++ b/Peel/Views/PrivacyResetRow.swift
@@ -8,11 +8,7 @@ struct PrivacyResetRow: View {
var body: some View {
HStack(spacing: 5) {
- Toggle(isOn: $isOn) {
- Text("Also reset privacy permissions")
- }
- .toggleStyle(.checkbox)
- InfoNote(name: String(localized: "Reset privacy permissions"), detail: detail)
+ PrivacyResetOption(isOn: $isOn, detail: detail)
Spacer(minLength: 0)
}
.padding(.vertical, 8)
@@ -25,3 +21,19 @@ struct PrivacyResetRow: View {
Text("macOS remembers what an app was allowed to access, such as the camera or the microphone, and keeps that after the app is gone. If this is selected, Peel clears it just before the app goes to the Trash, the last moment macOS can still find the app, so the app asks you again if you install it later. This happens only if the app itself is selected.")
}
}
+
+/// The checkbox and its circled i, for a row of their own or beside another option.
+struct PrivacyResetOption: View {
+ @Binding var isOn: Bool
+ let detail: Text
+
+ var body: some View {
+ HStack(spacing: 5) {
+ Toggle(isOn: $isOn) {
+ Text("Also reset privacy permissions")
+ }
+ .toggleStyle(.checkbox)
+ InfoNote(name: String(localized: "Reset privacy permissions"), detail: detail)
+ }
+ }
+}