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.

Show each tool's commands on the Tools tab behind a disclosure

Țugui Dragoșd9241fa4523e
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 9ca15eb1..ab45e4bc 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -53868,6 +53868,112 @@
}
}
},
+ "Install and set up" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nainstalovat a nastavit"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Installieren und einrichten"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Instalar y configurar"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Installer et configurer"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Installa e configura"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "インストールして設定"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "설치 및 설정"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Installeer en configureer"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Instaluj i konfiguruj"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Instalar e configurar"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Instalați și configurați"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Установить и настроить"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Installera och ställ in"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Yükle ve ayarla"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Інсталювати й налаштувати"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "安装并设置"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "安裝並設定"
+ }
+ }
+ }
+ },
"Installed" : {
"localizations" : {
"cs" : {
@@ -125373,6 +125479,112 @@
}
}
},
+ "Set up" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nastavit"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Einrichten"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Configurar"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Configurer"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Configura"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "設定"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "설정"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Configureer"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Konfiguruj"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Configurar"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Configurați"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Настроить"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ställ in"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ayarla"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Налаштувати"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "设置"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "設定"
+ }
+ }
+ }
+ },
"Set up %@ below." : {
"localizations" : {
"cs" : {
diff --git a/Peel/Views/ButtonDisclosureStyle.swift b/Peel/Views/ButtonDisclosureStyle.swift
new file mode 100644
index 00000000..b5e55d61
--- /dev/null
+++ b/Peel/Views/ButtonDisclosureStyle.swift
@@ -0,0 +1,39 @@
+import SwiftUI
+
+/// A disclosure opened by a button, so VoiceOver, Voice Control and Switch Control can open it: in a `Form` the
+/// system's disclosure triangle offers them no action. Its content is built only while it is open.
+struct ButtonDisclosureStyle: DisclosureGroupStyle {
+ func makeBody(configuration: Configuration) -> some View {
+ ButtonDisclosure(configuration: configuration)
+ }
+}
+
+private struct ButtonDisclosure: View {
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ let configuration: DisclosureGroupStyleConfiguration
+
+ var body: some View {
+ VStack(alignment: .leading, spacing: 0) {
+ Button {
+ withAnimation(reduceMotion ? nil : Motion.step.animation) {
+ configuration.$isExpanded.wrappedValue.toggle()
+ }
+ } label: {
+ HStack(spacing: 6) {
+ Image(systemName: "chevron.right")
+ .font(.caption.weight(.bold))
+ .foregroundStyle(.secondary)
+ .rotationEffect(.degrees(configuration.isExpanded ? 90 : 0))
+ .accessibilityHidden(true)
+ configuration.label
+ }
+ .minimumTarget()
+ .contentShape(.rect)
+ }
+ .buttonStyle(.plain)
+ if configuration.isExpanded {
+ configuration.content
+ }
+ }
+ }
+}
diff --git a/Peel/Views/CopyableLines.swift b/Peel/Views/CopyableLines.swift
index 246bc569..4c3cbbd1 100644
--- a/Peel/Views/CopyableLines.swift
+++ b/Peel/Views/CopyableLines.swift
@@ -1,15 +1,17 @@
import SwiftUI
struct CopyableLines: View {
- let caption: Text
+ let caption: Text?
let lines: [String]
var body: some View {
HStack(alignment: .bottom, spacing: 10) {
VStack(alignment: .leading, spacing: 2) {
- caption
- .font(.caption)
- .foregroundStyle(.secondary)
+ if let caption {
+ caption
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
Text(verbatim: lines.joined(separator: "\n"))
.font(.subheadline.monospaced())
.textSelection(.enabled)
diff --git a/Peel/Views/Terminal/ToolsTab.swift b/Peel/Views/Terminal/ToolsTab.swift
index 2acd01e9..eb6c99f6 100644
--- a/Peel/Views/Terminal/ToolsTab.swift
+++ b/Peel/Views/Terminal/ToolsTab.swift
@@ -90,11 +90,22 @@ private struct TerminalToolRow: View {
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
case .available:
- if !isInstalled {
- CopyableLines(caption: Text("Install"), lines: [tool.installCommand])
- }
- ForEach(tool.setup(prefix: state.prefix ?? Self.defaultPrefix), id: \.lines) { setup in
- CopyableLines(caption: Text(setup.place.caption), lines: setup.lines)
+ let setups = tool.setup(prefix: state.prefix ?? Self.defaultPrefix)
+ if !isInstalled || !setups.isEmpty {
+ let title: LocalizedStringKey =
+ if isInstalled { "Set up" } else if setups.isEmpty { "Install" } else { "Install and set up" }
+ DisclosureGroup(title) {
+ VStack(alignment: .leading, spacing: 6) {
+ if !isInstalled {
+ CopyableLines(caption: setups.isEmpty ? nil : Text("Install"), lines: [tool.installCommand])
+ }
+ ForEach(setups, id: \.lines) { setup in
+ CopyableLines(caption: Text(setup.place.caption), lines: setup.lines)
+ }
+ }
+ .padding(.top, 4)
+ }
+ .disclosureGroupStyle(ButtonDisclosureStyle())
}
}
}