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.

Start a list's scroll bar below its pinned section header on macOS 27

Țugui Dragoș433d475bb793
diff --git a/Peel/Views/AppDetailView.swift b/Peel/Views/AppDetailView.swift
index 22a88a29..3d499de1 100644
--- a/Peel/Views/AppDetailView.swift
+++ b/Peel/Views/AppDetailView.swift
@@ -190,6 +190,7 @@ struct AppDetailView: View {
.disabled(plan.isRemoving)
}
}
+ .scrollBarBelowSectionHeaders()
.scanState(phase, fadesInResults: false, scan: plan.scanRun)
.edgeBar(.bottom) {
if plan.scan != nil {
diff --git a/Peel/Views/AppList.swift b/Peel/Views/AppList.swift
index 0b7eeb60..c36bdfaa 100644
--- a/Peel/Views/AppList.swift
+++ b/Peel/Views/AppList.swift
@@ -41,6 +41,7 @@ struct AppList: View {
}
}
}
+ .scrollBarBelowSectionHeaders(!visible.waiting.isEmpty)
.overlay {
if library.isLoading, library.apps.isEmpty {
ProgressView()
diff --git a/Peel/Views/BackgroundItems/BackgroundItemList.swift b/Peel/Views/BackgroundItems/BackgroundItemList.swift
index f489cb4c..efcacc26 100644
--- a/Peel/Views/BackgroundItems/BackgroundItemList.swift
+++ b/Peel/Views/BackgroundItems/BackgroundItemList.swift
@@ -20,6 +20,7 @@ struct BackgroundItemList: View {
section(Text("Agents"), items: filtered.filter { $0.kind == .agent })
section(Text("Daemons"), items: filtered.filter { $0.kind == .daemon })
}
+ .scrollBarBelowSectionHeaders(!filtered.isEmpty)
.scanState(phase(filtered), isRescanning: isRescanning, scan: backgroundItems.scanRun) {
if let note = backgroundItems.unansweredNote, backgroundItems.items?.isEmpty == true {
ContentUnavailableView(
diff --git a/Peel/Views/Cloud/CloudView.swift b/Peel/Views/Cloud/CloudView.swift
index a5d03170..103e9856 100644
--- a/Peel/Views/Cloud/CloudView.swift
+++ b/Peel/Views/Cloud/CloudView.swift
@@ -82,6 +82,7 @@ struct CloudView: View {
}
}
}
+ .scrollBarBelowSectionHeaders()
.dimmedWhileBusy(cloud.isScanning)
.columnSearch(text: $searchText, prompt: "Search iCloud Drive", when: cloud.files?.isEmpty == false)
.scanState(phase(listed: listed), scan: cloud.scanRun) {
diff --git a/Peel/Views/Developer/DeveloperDetailView.swift b/Peel/Views/Developer/DeveloperDetailView.swift
index b66805b9..ab938586 100644
--- a/Peel/Views/Developer/DeveloperDetailView.swift
+++ b/Peel/Views/Developer/DeveloperDetailView.swift
@@ -38,6 +38,7 @@ struct DeveloperDetailView: View {
}
}
}
+ .scrollBarBelowSectionHeaders()
.dimmedWhileBusy(developer.isScanning)
.edgeBar(.bottom) {
RemovalBar(
diff --git a/Peel/Views/Duplicates/DuplicateFolderGroupView.swift b/Peel/Views/Duplicates/DuplicateFolderGroupView.swift
index f3f56b33..31d4a49d 100644
--- a/Peel/Views/Duplicates/DuplicateFolderGroupView.swift
+++ b/Peel/Views/Duplicates/DuplicateFolderGroupView.swift
@@ -28,6 +28,7 @@ struct DuplicateFolderGroupView: View {
}
.disabled(duplicates.isRemoving)
}
+ .scrollBarBelowSectionHeaders()
.edgeBar(.bottom) {
DuplicateRemovalBar()
}
diff --git a/Peel/Views/Duplicates/DuplicateGroupView.swift b/Peel/Views/Duplicates/DuplicateGroupView.swift
index 1e0a4081..47f99994 100644
--- a/Peel/Views/Duplicates/DuplicateGroupView.swift
+++ b/Peel/Views/Duplicates/DuplicateGroupView.swift
@@ -31,6 +31,7 @@ struct DuplicateGroupView: View {
}
.disabled(duplicates.isRemoving)
}
+ .scrollBarBelowSectionHeaders()
.edgeBar(.bottom) {
DuplicateRemovalBar()
}
diff --git a/Peel/Views/Duplicates/DuplicateList.swift b/Peel/Views/Duplicates/DuplicateList.swift
index 967316bc..53511709 100644
--- a/Peel/Views/Duplicates/DuplicateList.swift
+++ b/Peel/Views/Duplicates/DuplicateList.swift
@@ -36,6 +36,7 @@ struct DuplicateList: View {
fileRows(groups)
}
}
+ .scrollBarBelowSectionHeaders()
.columnSearch(text: $searchText, prompt: "Search Duplicates", when: !scan.groups.isEmpty || !scan.folderGroups.isEmpty)
.overlay {
if !(scan.groups.isEmpty && scan.folderGroups.isEmpty), groups.isEmpty, folderGroups.isEmpty {
diff --git a/Peel/Views/FileSearch/FileSearchList.swift b/Peel/Views/FileSearch/FileSearchList.swift
index 44483a2b..ba0b0950 100644
--- a/Peel/Views/FileSearch/FileSearchList.swift
+++ b/Peel/Views/FileSearch/FileSearchList.swift
@@ -57,6 +57,7 @@ struct FileSearchList: View {
.disabled(search.isSearching || search.isRemoving)
}
}
+ .scrollBarBelowSectionHeaders(search.results?.files.isEmpty == false)
.scanState(phase, isRescanning: search.isSearching, fadesInResults: false, scan: search.scanRun) {
if search.results == nil {
ContentUnavailableView(
diff --git a/Peel/Views/History/HistoryDetailView.swift b/Peel/Views/History/HistoryDetailView.swift
index 0172727b..5a7c1634 100644
--- a/Peel/Views/History/HistoryDetailView.swift
+++ b/Peel/Views/History/HistoryDetailView.swift
@@ -41,6 +41,7 @@ struct HistoryDetailView: View {
records(in: standing)
}
}
+ .scrollBarBelowSectionHeaders()
.edgeBar(.bottom) {
let selectedCount = standing?.selectedCount(in: history.selectedIDs) ?? 0
RestoreBar(
diff --git a/Peel/Views/History/HistoryList.swift b/Peel/Views/History/HistoryList.swift
index f5e5df0c..d80f93cc 100644
--- a/Peel/Views/History/HistoryList.swift
+++ b/Peel/Views/History/HistoryList.swift
@@ -51,6 +51,7 @@ struct HistoryList: View {
}
}
}
+ .scrollBarBelowSectionHeaders(!listed.isEmpty && !refused.isEmpty)
.columnSearch(text: $searchText, prompt: "Search History", when: !history.batches.isEmpty || !history.refusalBatches.isEmpty)
.edgeBar(.top) {
VStack(spacing: 8) {
diff --git a/Peel/Views/History/RefusalDetailView.swift b/Peel/Views/History/RefusalDetailView.swift
index 625fe891..557b171d 100644
--- a/Peel/Views/History/RefusalDetailView.swift
+++ b/Peel/Views/History/RefusalDetailView.swift
@@ -33,6 +33,7 @@ struct RefusalDetailView: View {
Text("Items")
}
}
+ .scrollBarBelowSectionHeaders()
.navigationTitle(Text(verbatim: batch.title))
.toolbar(removing: .title)
}
diff --git a/Peel/Views/Homebrew/HomebrewList.swift b/Peel/Views/Homebrew/HomebrewList.swift
index 19788fde..5583a2d2 100644
--- a/Peel/Views/Homebrew/HomebrewList.swift
+++ b/Peel/Views/Homebrew/HomebrewList.swift
@@ -32,6 +32,7 @@ struct HomebrewList: View {
section(Text("Formulae"), packages: byKind[.formula] ?? [])
section(Text("Casks"), packages: byKind[.cask] ?? [])
}
+ .scrollBarBelowSectionHeaders()
.scanState(phase(shown), isRescanning: isRescanning, scan: homebrew.scanRun) { placeholder(shown) }
// A `List` inserts a new section in one frame, with no animation, so the rows below it jump. To soften
// that, the column fades in when a health or vulnerability report appears or is cleared.
diff --git a/Peel/Views/Installers/InstallerDetailView.swift b/Peel/Views/Installers/InstallerDetailView.swift
index b3672919..5ec47460 100644
--- a/Peel/Views/Installers/InstallerDetailView.swift
+++ b/Peel/Views/Installers/InstallerDetailView.swift
@@ -73,6 +73,7 @@ struct InstallerDetailView: View {
}
}
}
+ .scrollBarBelowSectionHeaders()
.dimmedWhileBusy(installers.isScanning)
.edgeBar(.bottom) {
if kind != .deviceBackup {
diff --git a/Peel/Views/Intel/IntelList.swift b/Peel/Views/Intel/IntelList.swift
index ed7a49e7..e978643c 100644
--- a/Peel/Views/Intel/IntelList.swift
+++ b/Peel/Views/Intel/IntelList.swift
@@ -36,6 +36,7 @@ struct IntelList: View {
}
}
}
+ .scrollBarBelowSectionHeaders(!byKind.isEmpty)
.columnSearch(text: $searchText, prompt: "Search Intel Software", when: !intel.findings.isEmpty)
.scanState(phase(matching), isRescanning: isRescanning, scan: intel.scanRun) {
if !searchText.isEmpty, matching.isEmpty {
diff --git a/Peel/Views/MultipleAppsView.swift b/Peel/Views/MultipleAppsView.swift
index 7c9be612..c3db5c96 100644
--- a/Peel/Views/MultipleAppsView.swift
+++ b/Peel/Views/MultipleAppsView.swift
@@ -105,6 +105,7 @@ struct MultipleAppsView: View {
}
}
}
+ .scrollBarBelowSectionHeaders()
.dimmedWhileBusy(plan.isRemoving)
.disabled(plan.isRemoving)
.scanState(phase, isRescanning: isRescanning, fadesInResults: false, scan: plan.scanRun)
diff --git a/Peel/Views/Orphans/OrphanDetailView.swift b/Peel/Views/Orphans/OrphanDetailView.swift
index 45636141..09e90098 100644
--- a/Peel/Views/Orphans/OrphanDetailView.swift
+++ b/Peel/Views/Orphans/OrphanDetailView.swift
@@ -52,6 +52,7 @@ struct OrphanDetailView: View {
}
}
}
+ .scrollBarBelowSectionHeaders()
.dimmedWhileBusy(orphans.isScanning)
.edgeBar(.bottom) {
RemovalBar(page: group.page, isScanning: orphans.isScanning, scan: orphans.scanRun)
diff --git a/Peel/Views/Packages/PackageDetailView.swift b/Peel/Views/Packages/PackageDetailView.swift
index e803df29..43a4f550 100644
--- a/Peel/Views/Packages/PackageDetailView.swift
+++ b/Peel/Views/Packages/PackageDetailView.swift
@@ -69,6 +69,7 @@ struct PackageDetailView: View {
}
}
}
+ .scrollBarBelowSectionHeaders()
.disabled(packages.isWorking)
.dimmedWhileBusy(packages.isScanning)
.edgeBar(.bottom) {
diff --git a/Peel/Views/Plugins/PluginList.swift b/Peel/Views/Plugins/PluginList.swift
index 16a8c574..9e594565 100644
--- a/Peel/Views/Plugins/PluginList.swift
+++ b/Peel/Views/Plugins/PluginList.swift
@@ -44,6 +44,7 @@ struct PluginList: View {
}
}
}
+ .scrollBarBelowSectionHeaders(!byCategory.isEmpty)
.scanState(phase(filtered), isRescanning: isRescanning, scan: plugins.scanRun) {
if plugins.plugins?.isEmpty == true {
ContentUnavailableView(
diff --git a/Peel/Views/Projects/ProjectDetailView.swift b/Peel/Views/Projects/ProjectDetailView.swift
index bc42bc1c..9ea14cde 100644
--- a/Peel/Views/Projects/ProjectDetailView.swift
+++ b/Peel/Views/Projects/ProjectDetailView.swift
@@ -59,6 +59,7 @@ struct ProjectDetailView: View {
Text("Backups")
}
}
+ .scrollBarBelowSectionHeaders()
.dimmedWhileBusy(projects.isScanning)
.edgeBar(.bottom) {
RemovalBar(
diff --git a/Peel/Views/ResetSheet.swift b/Peel/Views/ResetSheet.swift
index 6119a20a..c1f7a118 100644
--- a/Peel/Views/ResetSheet.swift
+++ b/Peel/Views/ResetSheet.swift
@@ -170,6 +170,7 @@ struct ResetSheet: View {
}
}
}
+ .scrollBarBelowSectionHeaders()
.scanState(phase, scan: plan.scanRun) {
ContentUnavailableView(
"Nothing to Reset",
@@ -311,6 +312,7 @@ struct ResetSheet: View {
}
}
}
+ .scrollBarBelowSectionHeaders()
.edgeBar(.bottom) {
HStack {
Spacer()
diff --git a/Peel/Views/SectionHeaderScrollBar.swift b/Peel/Views/SectionHeaderScrollBar.swift
new file mode 100644
index 00000000..65bae8d3
--- /dev/null
+++ b/Peel/Views/SectionHeaderScrollBar.swift
@@ -0,0 +1,18 @@
+import SwiftUI
+
+extension View {
+ /// Starts a list's scroll bar below the band of a section header held at the top of the list, as Finder's starts
+ /// below its column headings. On macOS 27 it otherwise starts level with that band. `hasHeaders` is whether the
+ /// list shows any section header at the moment.
+ @ViewBuilder
+ func scrollBarBelowSectionHeaders(_ hasHeaders: Bool = true) -> some View {
+ if #available(macOS 27, *) {
+ contentMargins(.top, hasHeaders ? sectionHeaderBand : 0, for: .scrollIndicators)
+ } else {
+ self
+ }
+ }
+}
+
+/// The height of the row AppKit draws for a list's section header.
+private let sectionHeaderBand: CGFloat = 28
diff --git a/Peel/Views/Space/SpaceDetailView.swift b/Peel/Views/Space/SpaceDetailView.swift
index 61268aab..8a0bd51d 100644
--- a/Peel/Views/Space/SpaceDetailView.swift
+++ b/Peel/Views/Space/SpaceDetailView.swift
@@ -85,6 +85,7 @@ struct SpaceDetailView: View {
Text("Where")
}
}
+ .scrollBarBelowSectionHeaders()
.dimmedWhileBusy(space.isScanning)
.edgeBar(.bottom) {
if !item.isReadOnly {
diff --git a/Peel/Views/Space/SpaceList.swift b/Peel/Views/Space/SpaceList.swift
index b4aa6c4c..5c828279 100644
--- a/Peel/Views/Space/SpaceList.swift
+++ b/Peel/Views/Space/SpaceList.swift
@@ -61,6 +61,7 @@ struct SpaceList: View {
}
}
}
+ .scrollBarBelowSectionHeaders(space.report?.items.isEmpty == false)
.columnSearch(text: $searchText, prompt: "Search Space", when: space.report?.items.isEmpty == false)
.scanState(
space.report != nil ? .content : space.scanRun.wasStopped ? .stopped : .scanning(.walk),