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
Tools one doesn't use can leave the sidebar
Țugui Dragoș1629c67a20cb
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 1373cf31..654a22df 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -94463,6 +94463,112 @@}}},+ "Sidebar" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Boční panel"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Seitenleiste"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Barra lateral"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Barre latérale"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Barra laterale"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "サイドバー"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "사이드바"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Navigatiekolom"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Pasek boczny"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Barra Lateral"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Bară laterală"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Боковое меню"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Sidofält"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kenar Çubuğu"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Бічна панель"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "边栏"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "側邊欄"+ }+ }+ }+ },"Signed by" : {"localizations" : {"cs" : {@@ -113651,6 +113757,112 @@}}},+ "Turn a tool off to leave it out of the sidebar. The View menu and Shortcuts still open it." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Chcete-li nástroj z bočního panelu vynechat, vypněte ho. Otevřít ho můžete dál z nabídky Zobrazení i v aplikaci Zkratky."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Deaktiviere ein Tool, damit es nicht in der Seitenleiste angezeigt wird. Über das Menü „Darstellung“ und die App „Kurzbefehle“ kannst du es weiterhin öffnen."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Desactiva una herramienta para dejarla fuera de la barra lateral. Podrás seguir abriéndola desde el menú Visualización o desde la app Atajos."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Désactivez un outil pour ne plus l’afficher dans la barre latérale. Le menu Présentation et l’app Raccourcis permettent toujours de l’ouvrir."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Disattiva uno strumento per toglierlo dalla barra laterale. Puoi comunque aprirlo dal menu Vista o tramite Comandi Rapidi."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ツールをオフにすると、サイドバーに表示されなくなります。“表示”メニューと“ショートカット”からは引き続き開くことができます。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "도구를 끄면 사이드바에 표시되지 않습니다. 보기 메뉴와 단축어 앱에서는 여전히 열 수 있습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Schakel een tool uit om hem niet in de navigatiekolom te tonen. Via het Weergave-menu en de Opdrachten-app kun je hem nog steeds openen."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Wyłącz narzędzie, aby nie pokazywać go na pasku bocznym. Nadal możesz je otworzyć z menu Widok lub za pomocą aplikacji Skróty."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Desative uma ferramenta para deixá-la de fora da barra lateral. O menu Visualizar e o app Atalhos ainda podem abri-la."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dezactivați un instrument ca să nu mai apară în bara laterală. Meniul Vizualizare și aplicația Scurtături îl pot deschide în continuare."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Выключите раздел, чтобы убрать его из бокового меню. Его по-прежнему можно открыть из меню «Вид» и с помощью приложения «Команды»."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stäng av ett verktyg så visas det inte i sidofältet. Du kan fortfarande öppna det från menyn Innehåll och i Genvägar."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Bir aracın kenar çubuğunda görünmemesi için onu kapatın. Görüntü menüsünden ve Kestirmeler ile yine de açılabilir."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Вимкніть розділ, щоб не показувати його на бічній панелі. Його все одно можна відкрити з меню «Перегляд» і за допомогою Швидких команд."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "关闭某个工具,它就不会出现在边栏中。仍可通过“显示”菜单和“快捷指令”打开它。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "關閉某個工具即可讓它不顯示在側邊欄中。仍可從「顯示方式」選單和「捷徑」打開它。"+ }+ }+ }+ },"Turn off all tweaks?" : {"localizations" : {"cs" : {diff --git a/Peel/Navigation/Tool.swift b/Peel/Navigation/Tool.swiftindex aafd58d0..282a0596 100644--- a/Peel/Navigation/Tool.swift+++ b/Peel/Navigation/Tool.swift@@ -94,6 +94,27 @@ enum Tool: String, CaseIterable, Identifiable {}}+extension Tool {+ /// Whether the sidebar may leave this tool out. Home, Applications, and History always stay: Applications is+ /// where the Finder extension, `peel://open`, and the update notices lead, and History is the way back.+ var canBeHidden: Bool {+ switch self {+ case .home, .applications, .history: false+ default: true+ }+ }++ /// The tools the sidebar leaves out, read from their names joined by commas. A name this version doesn't+ /// know, and a tool that can't be hidden, are ignored.+ static func hidden(in stored: String) -> Set<Tool> {+ Set(stored.split(separator: ",").compactMap { Tool(rawValue: String($0)) }.filter(\.canBeHidden))+ }++ static func storing(hidden tools: Set<Tool>) -> String {+ tools.map(\.rawValue).sorted().joined(separator: ",")+ }+}+extension Tool.Group {var title: LocalizedStringResource? {switch self {diff --git a/Peel/Navigation/ToolSidebar.swift b/Peel/Navigation/ToolSidebar.swiftindex 6c4488b3..312ca62f 100644--- a/Peel/Navigation/ToolSidebar.swift+++ b/Peel/Navigation/ToolSidebar.swift@@ -16,6 +16,9 @@ struct ToolSidebar: View {@AppStorage("sidebar.apps.expanded") private var isAppsExpanded = true@AppStorage("sidebar.storage.expanded") private var isStorageExpanded = true@AppStorage("sidebar.system.expanded") private var isSystemExpanded = true+ /// Tools the user turned off in Settings. They leave the sidebar only: the View menu, Shortcuts, and links+ /// still open them, as Finder's Go menu opens a place its sidebar hides.+ @AppStorage(SettingsKey.hiddenTools) private var hiddenTools = ""@Binding var tool: Tool@Binding var page: SidebarDestination?/// The column's width, set by the widest label, because in some languages the longer tool names need more@@ -58,7 +61,7 @@ struct ToolSidebar: View {var body: some View {List(selection: selection) {Section {- ForEach(Tool.Group.home.tools, content: row)+ ForEach(shown(Tool.Group.home.tools), content: row)Label { Text("Settings") } icon: { icon("gearshape") }.tag(SidebarDestination.settings)}@@ -122,14 +125,22 @@ struct ToolSidebar: View {/// restores a section's expanded state on its own and would decide whether a group starts open.@ViewBuilderprivate func group(_ group: Tool.Group, isExpanded: Binding<Bool>) -> some View {- Section {- heading(group, isExpanded: isExpanded)- if isExpanded.wrappedValue {- rows(in: group)+ let tools = shown(group.tools)+ if !tools.isEmpty {+ Section {+ heading(group, isExpanded: isExpanded)+ if isExpanded.wrappedValue {+ ForEach(tools, content: row)+ }}}}+ private func shown(_ tools: [Tool]) -> [Tool] {+ let hidden = Tool.hidden(in: hiddenTools)+ return tools.filter { !hidden.contains($0) }+ }+private func heading(_ group: Tool.Group, isExpanded: Binding<Bool>) -> some View {Button {withAnimation(reduceMotion ? nil : Motion.step.animation) {@@ -164,12 +175,6 @@ struct ToolSidebar: View {.fontWeight(.semibold)}- private func rows(in group: Tool.Group) -> some View {- ForEach(group.tools) { tool in- row(for: tool)- }- }-private func row(for tool: Tool) -> some View {HStack(spacing: 0) {Label {@@ -192,8 +197,8 @@ struct ToolSidebar: View {}/// Every label the column can show, laid out in the rows' font but never drawn, to measure the widest one. The- /// width then follows the language, the text size, and Bold Text. It sits behind the Home row, which is shown- /// whichever groups are collapsed.+ /// width then follows the language, the text size, Bold Text, and the tools left out. It sits behind the Home+ /// row, which is shown whichever groups are collapsed and whatever is hidden.private var ruler: some View {VStack(alignment: .leading, spacing: 0) {HStack(spacing: 8) {@@ -201,12 +206,12 @@ struct ToolSidebar: View {// Stands in for the attention badge that can appear beside Home.Color.clear.frame(width: 16, height: 1)}- ForEach(Tool.allCases.filter { $0 != .home }) { tool in+ ForEach(shown(Tool.allCases.filter { $0 != .home })) { tool inLabel { Text(tool.title) } icon: { icon(tool.systemImage) }}Label { Text("Settings") } icon: { icon("gearshape") }ForEach(Tool.Group.allCases, id: \.self) { group in- if let title = group.title {+ if let title = group.title, !shown(group.tools).isEmpty {HStack(spacing: 6) {Text(title).font(.subheadline.weight(.semibold))diff --git a/Peel/Views/Settings/SettingsView.swift b/Peel/Views/Settings/SettingsView.swiftindex 6fb28c6d..a4139759 100644--- a/Peel/Views/Settings/SettingsView.swift+++ b/Peel/Views/Settings/SettingsView.swift@@ -46,6 +46,8 @@ struct SettingsView: View {enum SettingsKey {static let checksForAppUpdates = "checksForAppUpdates"static let watchesTrash = "watchesTrash"+ /// The tools the sidebar leaves out (`Tool.hidden(in:)`).+ static let hiddenTools = "sidebar.hiddenTools"/// The `peel` tool reads these three keys too, so they are defined once, in PeelCore.static let updateSource = UpdatePreferences.Key.sourcestatic let ignoredUpdateApps = UpdatePreferences.Key.ignoredApps@@ -79,6 +81,7 @@ private struct GeneralSettingsView: View {@AppStorage(SettingsKey.checksForAppUpdates) private var checksForAppUpdates = true@AppStorage(SettingsKey.updateSource) private var updateSource = UpdateSource.automatic.rawValue@AppStorage(SettingsKey.watchesTrash) private var watchesTrash = false+ @AppStorage(SettingsKey.hiddenTools) private var hiddenTools = ""@Environment(TrashMonitor.self) private var trashMonitor@Environment(\.scenePhase) private var scenePhase@Environment(AppLibrary.self) private var library@@ -194,6 +197,17 @@ 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) }+ }+ }+ } header: {+ titled("Sidebar", "Turn a tool off to leave it out of the sidebar. The View menu and Shortcuts still open it.")+ }+Section("Elsewhere on This Mac") {LabeledContent {Button("Open System Settings") {@@ -401,6 +415,17 @@ extension GeneralSettingsView {}extension GeneralSettingsView {+ fileprivate func showsInSidebar(_ tool: Tool) -> Binding<Bool> {+ Binding(+ get: { !Tool.hidden(in: hiddenTools).contains(tool) },+ set: { shows in+ var hidden = Tool.hidden(in: hiddenTools)+ if shows { hidden.remove(tool) } else { hidden.insert(tool) }+ hiddenTools = Tool.storing(hidden: hidden)+ }+ )+ }+fileprivate var isShowingSelfRemovalFailure: Binding<Bool> {Binding(get: { selfUninstall.failure != nil },diff --git a/README.md b/README.mdindex 6106babb..8057aa7f 100644--- a/README.md+++ b/README.md@@ -133,6 +133,8 @@ before, or leaves it to macOS.- **Export:** what's installed and where each app came from, as JSON, a spreadsheet, plain text, or a Brewfile.- **Shortcuts:** actions that open a page in Peel for you to look at. None of them removes anything.+- **Sidebar:** turn off the tools you don't use in Settings, and they leave the sidebar. The View menu and+ Shortcuts still open them.- **The `peel` command:** most of the above, from Terminal.## Safe by design