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.

Choose the sidebar's tools from one button in Settings

Țugui Dragoș9fb487d8f79f
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index ab45e4bc..d35a6746 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -21929,6 +21929,112 @@
}
}
},
+ "Choose Tools…" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Vybrat nástroje…"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tools auswählen …"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Seleccionar herramientas…"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Choisir les outils…"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Scegli gli strumenti…"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ツールを選択…"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "도구 선택…"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Kies tools…"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Wybierz narzędzia…"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Escolher Ferramentas…"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Alegeți instrumentele…"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Выбрать разделы…"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Välj verktyg…"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Araçları Seç…"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Вибрати розділи…"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "选取工具…"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "選擇工具⋯"
+ }
+ }
+ }
+ },
"Choose a Folder…" : {
"localizations" : {
"cs" : {
@@ -35219,6 +35325,112 @@
}
}
},
+ "Every tool is in the sidebar." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Všechny nástroje jsou v bočním panelu."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Jedes Tool wird in der Seitenleiste angezeigt."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Todas las herramientas están en la barra lateral."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tous les outils sont affichés dans la barre latérale."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tutti gli strumenti sono nella barra laterale."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "すべてのツールがサイドバーに表示されています。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "모든 도구가 사이드바에 표시됩니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Elke tool staat in de navigatiekolom."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Wszystkie narzędzia są na pasku bocznym."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Todas as ferramentas estão na barra lateral."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Toate instrumentele apar în bara laterală."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Все разделы показаны в боковом меню."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Alla verktyg visas i sidofältet."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tüm araçlar kenar çubuğunda görünüyor."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "На бічній панелі показано всі розділи."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "所有工具都会出现在边栏中。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "所有工具都顯示在側邊欄中。"
+ }
+ }
+ }
+ },
"Everything Else" : {
"localizations" : {
"cs" : {
@@ -63564,6 +63776,112 @@
}
}
},
+ "Left out: %@." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Vynecháno: %@."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nicht in der Seitenleiste angezeigt: %@."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Fuera de la barra lateral: %@."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Outils non affichés : %@."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Fuori dalla barra laterale: %@."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "サイドバーに表示されていないツール: %@。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "사이드바에 표시되지 않음: %@."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Niet in de navigatiekolom: %@."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Narzędzia niepokazywane na pasku bocznym: %@."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Fora da barra lateral: %@."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nu apar în bara laterală: %@."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Убрано из бокового меню: %@."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Visas inte i sidofältet: %@."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Kenar çubuğunda görünmeyenler: %@."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Не показано: %@."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "不会出现在边栏中:%@。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "不顯示在側邊欄中:%@。"
+ }
+ }
+ }
+ },
"Lets Git clone and work with repositories that keep large files in Git LFS. `git lfs install` sets it up once for your account." : {
"localizations" : {
"cs" : {
diff --git a/Peel/Views/Settings/SettingsView.swift b/Peel/Views/Settings/SettingsView.swift
index 533c420e..aa243593 100644
--- a/Peel/Views/Settings/SettingsView.swift
+++ b/Peel/Views/Settings/SettingsView.swift
@@ -133,6 +133,9 @@ private struct GeneralSettingsView: View {
@Environment(StandingWork.self) private var background
@Environment(HomeModel.self) private var home
@State private var selfUninstall = SelfUninstall()
+ @State private var isChoosingSidebarTools = false
+ // The widest tool symbol at the body size, so the titles of the tools line up.
+ @ScaledMetric(relativeTo: .body) private var toolSymbolWidth = 20.0
@State private var isConfirmingSelfRemoval = false
// The login item's state is read when the page appears (`readStandings()`), not as an initial value:
// initial values run on every `init` of the view, and each read is a synchronous call to a daemon.
@@ -248,11 +251,15 @@ private struct GeneralSettingsView: View {
}
Section {
- // In the sidebar's own order.
- ForEach(Tool.Group.allCases.flatMap(\.tools).filter(\.canBeHidden)) { tool in
- Toggle(isOn: showsInSidebar(tool)) {
- Label { Text(tool.title) } icon: { Image(systemName: tool.systemImage) }
+ LabeledContent {
+ Button("Choose Tools…") {
+ isChoosingSidebarTools = true
+ }
+ .popover(isPresented: $isChoosingSidebarTools, arrowEdge: .bottom) {
+ sidebarToolsChoice
}
+ } label: {
+ Text(sidebarToolsSummary)
}
} header: {
titled("Sidebar", "Turn a tool off to leave it out of the sidebar. The View menu and Shortcuts still open it.")
@@ -479,6 +486,26 @@ extension GeneralSettingsView {
}
extension GeneralSettingsView {
+ private var sidebarToolsSummary: String {
+ let hidden = Tool.hidden(in: hiddenTools)
+ let left = Tool.Group.allCases.flatMap(\.tools).filter(hidden.contains).map { String(localized: $0.title) }
+ guard !left.isEmpty else { return String(localized: "Every tool is in the sidebar.") }
+ return String(localized: "Left out: \(left.formatted(.list(type: .and))).")
+ }
+
+ private var sidebarToolsChoice: some View {
+ VStack(alignment: .leading, spacing: 8) {
+ ForEach(Tool.Group.allCases.flatMap(\.tools).filter(\.canBeHidden)) { tool in
+ Toggle(isOn: showsInSidebar(tool)) {
+ Label { Text(tool.title) } icon: { Image(systemName: tool.systemImage) }
+ }
+ .toggleStyle(.checkbox)
+ }
+ }
+ .labelReservedIconWidth(toolSymbolWidth)
+ .padding(16)
+ }
+
fileprivate func showsInSidebar(_ tool: Tool) -> Binding<Bool> {
Binding(
get: { !Tool.hidden(in: hiddenTools).contains(tool) },