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
Float Turn All Off on glass on macOS 27
Țugui Dragoșc4f846524b15
diff --git a/Peel/Views/Terminal/GitTab.swift b/Peel/Views/Terminal/GitTab.swiftindex b3b261f7..140f88e1 100644--- a/Peel/Views/Terminal/GitTab.swift+++ b/Peel/Views/Terminal/GitTab.swift@@ -43,14 +43,14 @@ struct GitTab: View {}}.formStyle(.grouped)- .safeAreaBar(edge: .bottom) {+ .turnAllOffBar(TurnAllOffBar(explanation: "Peel changes these with `git config --global`. Turning one off puts back what was there before Peel, or leaves it to Git.",isEnabled: git.hasSomethingOn) {isConfirmingTurnAllOff = true}- }+ ).alert("Turn off all Git settings?", isPresented: $isConfirmingTurnAllOff) {Button("Turn All Off") { git.turnAllOff() }Button("Cancel", role: .cancel) {}diff --git a/Peel/Views/Terminal/SSHTab.swift b/Peel/Views/Terminal/SSHTab.swiftindex 4565c04d..bad84258 100644--- a/Peel/Views/Terminal/SSHTab.swift+++ b/Peel/Views/Terminal/SSHTab.swift@@ -40,14 +40,14 @@ struct SSHTab: View {}}.formStyle(.grouped)- .safeAreaBar(edge: .bottom) {+ .turnAllOffBar(TurnAllOffBar(explanation: "Peel writes these to a file of its own, which ssh reads. Turning one off takes it out of that file, and your ~/.ssh/config stays as it is.",isEnabled: ssh.hasSomethingOn) {isConfirmingTurnAllOff = true}- }+ ).alert("Turn off all SSH settings?", isPresented: $isConfirmingTurnAllOff) {Button("Turn All Off") { ssh.turnAllOff() }Button("Cancel", role: .cancel) {}diff --git a/Peel/Views/Terminal/ShellTab.swift b/Peel/Views/Terminal/ShellTab.swiftindex fe18d2d3..365798ac 100644--- a/Peel/Views/Terminal/ShellTab.swift+++ b/Peel/Views/Terminal/ShellTab.swift@@ -43,14 +43,14 @@ struct ShellTab: View {}}.formStyle(.grouped)- .safeAreaBar(edge: .bottom) {+ .turnAllOffBar(TurnAllOffBar(explanation: "Peel writes these to a file of its own, which zsh reads. Turning one off takes it out of that file, and your ~/.zshrc stays as it is.",isEnabled: shell.hasSomethingOn) {isConfirmingTurnAllOff = true}- }+ ).alert("Turn off all shell settings?", isPresented: $isConfirmingTurnAllOff) {Button("Turn All Off") { shell.turnAllOff() }Button("Cancel", role: .cancel) {}diff --git a/Peel/Views/TurnAllOffBar.swift b/Peel/Views/TurnAllOffBar.swiftindex 4db36eed..aa8eaa88 100644--- a/Peel/Views/TurnAllOffBar.swift+++ b/Peel/Views/TurnAllOffBar.swift@@ -6,18 +6,55 @@ struct TurnAllOffBar: View {let turnOff: () -> Voidvar body: some View {- VStack(spacing: 10) {- Button("Turn All Off", action: turnOff)- .buttonStyle(.glass)- .disabled(!isEnabled)- Text(explanation)- .font(.caption)- .foregroundStyle(.secondary)- .multilineTextAlignment(.center)- // Tweaks' English sentence is 642 points wide at this size, so a narrower frame would wrap it.- .frame(maxWidth: 680)+ if #available(macOS 27, *) {+ // macOS 27 tints the whole width behind a bar at the foot of a page, so each part floats on glass of+ // its own instead and the page shows through around them.+ GlassEffectContainer {+ VStack(spacing: 10) {+ button+ caption+ .padding(.horizontal, 12)+ .padding(.vertical, 6)+ .glassEffect(.regular, in: .capsule)+ }+ }+ .padding(.horizontal, 20)+ .padding(.bottom, 10)+ } else {+ VStack(spacing: 10) {+ button+ caption+ }+ .padding(.horizontal, 20)+ .padding(.bottom, 10)+ }+ }++ private var button: some View {+ Button("Turn All Off", action: turnOff)+ .buttonStyle(.glass)+ .disabled(!isEnabled)+ }++ private var caption: some View {+ Text(explanation)+ .font(.caption)+ .foregroundStyle(.secondary)+ .multilineTextAlignment(.center)+ // Tweaks' English sentence is 642 points wide at this size, so a narrower frame would wrap it.+ .frame(maxWidth: 680)+ }+}++extension View {+ /// Puts the bar at the foot of the page. On macOS 27 it takes room as an inset rather than as a bar, since a+ /// bar gets a tinted background across the page.+ @ViewBuilder+ func turnAllOffBar(_ bar: TurnAllOffBar) -> some View {+ if #available(macOS 27, *) {+ safeAreaInset(edge: .bottom) { bar }+ } else {+ safeAreaBar(edge: .bottom) { bar }}- .padding(.horizontal, 20)- .padding(.bottom, 10)}}diff --git a/Peel/Views/Tweaks/TweakPage.swift b/Peel/Views/Tweaks/TweakPage.swiftindex c2b7373f..518c7471 100644--- a/Peel/Views/Tweaks/TweakPage.swift+++ b/Peel/Views/Tweaks/TweakPage.swift@@ -31,14 +31,14 @@ struct TweakPage: View {.motion(.settle, .movement, value: tweaks.isSleepDisabled)}// Shown once for every tab, at the foot of the page, rather than under each group's section.- .safeAreaBar(edge: .bottom) {+ .turnAllOffBar(TurnAllOffBar(explanation: "Each of these is a setting macOS already has. Turning one off puts back what was there before Peel, or leaves it to macOS.",isEnabled: tweaks.hasSomethingOn && !tweaks.isTurningAllOff) {isConfirmingTurnAllOff = true}- }+ ).alert("Turn off all tweaks?", isPresented: $isConfirmingTurnAllOff) {Button("Turn All Off") {Task { await tweaks.turnAllOff() }