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.

Warnings keep their color on the symbol and their words readable

Țugui Dragoșb6108c567efc
diff --git a/Peel/Navigation/ToolSidebar.swift b/Peel/Navigation/ToolSidebar.swift
index af477d96..486b7c23 100644
--- a/Peel/Navigation/ToolSidebar.swift
+++ b/Peel/Navigation/ToolSidebar.swift
@@ -102,9 +102,15 @@ struct ToolSidebar: View {
Text(verbatim: "Peel")
.font(.callout.weight(.semibold))
if let update = library.newerPeel {
- Text("\(update.version) is out")
- .font(.caption)
- .foregroundStyle(.tint)
+ Label {
+ Text("\(update.version) is out")
+ } icon: {
+ Image(systemName: "arrow.down.circle.fill")
+ .foregroundStyle(.tint)
+ }
+ .labelStyle(.titleAndIcon)
+ .font(.caption)
+ .foregroundStyle(.secondary)
} else {
Text(verbatim: AppVersion.display)
.font(.caption)
diff --git a/Peel/Views/BackgroundItems/BackgroundItemList.swift b/Peel/Views/BackgroundItems/BackgroundItemList.swift
index c8ab6781..4f487702 100644
--- a/Peel/Views/BackgroundItems/BackgroundItemList.swift
+++ b/Peel/Views/BackgroundItems/BackgroundItemList.swift
@@ -128,9 +128,9 @@ private struct BackgroundItemRow: View {
.lineLimit(1)
.truncationMode(.middle)
if item.isOrphan {
- Text("Nothing left to run")
+ WarningLabel(title: Text("Nothing left to run"))
.font(.caption)
- .foregroundStyle(.orange)
+ .foregroundStyle(.secondary)
.lineLimit(1)
} else if let ownerName {
Group {
diff --git a/Peel/Views/Settings/SettingsView.swift b/Peel/Views/Settings/SettingsView.swift
index bb407aba..b7483d3e 100644
--- a/Peel/Views/Settings/SettingsView.swift
+++ b/Peel/Views/Settings/SettingsView.swift
@@ -185,8 +185,7 @@ private struct GeneralSettingsView: View {
"When you move an app to the Trash yourself, Peel offers to remove the files it left behind. Peel stays in the menu bar to do it.")
if watchesTrash, trashMonitor.status == .needsFullDiskAccess {
HStack {
- Label("Peel needs Full Disk Access to watch the Trash.", systemImage: "lock.trianglebadge.exclamationmark")
- .foregroundStyle(.orange)
+ WarningLabel(title: Text("Peel needs Full Disk Access to watch the Trash."), systemImage: "lock.trianglebadge.exclamationmark")
Spacer()
// Goes through `HomeModel`, so Home offers "Reopen Peel" afterward: Full Disk Access
// applies only to a process started after it is granted.
@@ -201,8 +200,7 @@ private struct GeneralSettingsView: View {
"Starts Peel when you log in. “Watch the Trash” works only while Peel is running.")
if needsApprovalToOpenAtLogin {
HStack {
- Label("Peel is turned off in Login Items & Extensions, so macOS won’t start it.", systemImage: "exclamationmark.triangle")
- .foregroundStyle(.orange)
+ WarningLabel(title: Text("Peel is turned off in Login Items & Extensions, so macOS won’t start it."))
Spacer()
Button("Open System Settings") {
SMAppService.openSystemSettingsLoginItems()
@@ -210,8 +208,7 @@ private struct GeneralSettingsView: View {
}
}
if let loginItemFailure {
- Label(loginItemFailure, systemImage: "exclamationmark.triangle")
- .foregroundStyle(.orange)
+ WarningLabel(title: Text(loginItemFailure))
.textSelection(.enabled)
}
}
diff --git a/Peel/Views/WarningLabel.swift b/Peel/Views/WarningLabel.swift
new file mode 100644
index 00000000..04eb4ca5
--- /dev/null
+++ b/Peel/Views/WarningLabel.swift
@@ -0,0 +1,17 @@
+import SwiftUI
+
+/// A warning beside a setting or under a row. The symbol takes the warning's color and the words keep the text's
+/// own: orange words read at about 2.3 to 1 on a light background, under the 4.5 to 1 text needs.
+struct WarningLabel: View {
+ let title: Text
+ var systemImage = "exclamationmark.triangle"
+
+ var body: some View {
+ Label {
+ title
+ } icon: {
+ Image(systemName: systemImage)
+ .foregroundStyle(.orange)
+ }
+ }
+}