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.

A row's note can be opened from its menu, and VoiceOver reads all of it

Țugui Dragoș22f730a95d53
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 45c30d63..3f9d8b8e 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -100433,6 +100433,112 @@
}
}
},
+ "Show Note" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Zobrazit poznámku"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hinweis anzeigen"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mostrar nota"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Afficher la note"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mostra nota"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "説明を表示"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "설명 보기"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Toon toelichting"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Pokaż objaśnienie"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mostrar Nota"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Afișați informațiile"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Показать пояснение"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Visa förklaring"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Notu Göster"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Показати примітку"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "显示说明"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "顯示附註"
+ }
+ }
+ }
+ },
"Show What an App Leaves Behind" : {
"localizations" : {
"cs" : {
diff --git a/Peel/Views/InfoNote.swift b/Peel/Views/InfoNote.swift
index 9170bc56..c55bdb8a 100644
--- a/Peel/Views/InfoNote.swift
+++ b/Peel/Views/InfoNote.swift
@@ -15,8 +15,14 @@ struct InfoNote: View {
var isAlbum = false
/// True for the note in each row of a list of items, whose button takes `RowButtonStyle`.
var isInRow = false
+ /// Whether the note is open, when something beside the button opens it as well, such as a row's menu.
+ var opening: Binding<Bool>?
- @State private var isOpen = false
+ @State private var isOpenHere = false
+
+ private var isOpen: Binding<Bool> {
+ opening ?? $isOpenHere
+ }
init(
name: String,
@@ -25,7 +31,8 @@ struct InfoNote: View {
footnote: Text? = nil,
isMarked: Bool = false,
isAlbum: Bool = false,
- isInRow: Bool = false
+ isInRow: Bool = false,
+ opening: Binding<Bool>? = nil
) {
self.name = name
self.detail = detail
@@ -34,6 +41,7 @@ struct InfoNote: View {
self.isMarked = isMarked
self.isAlbum = isAlbum
self.isInRow = isInRow
+ self.opening = opening
}
/// A marked note says so in its shape as well: by color alone it is the fainter of the two in light mode.
@@ -42,10 +50,10 @@ struct InfoNote: View {
}
var body: some View {
- Button { isOpen = true } label: {
+ Button { isOpen.wrappedValue = true } label: {
Image(systemName: mark)
.font(.callout.weight(.semibold))
- .foregroundStyle(isOpen || isMarked ? noteTint(isAlbum: isAlbum) : Color.secondary)
+ .foregroundStyle(isOpen.wrappedValue || isMarked ? noteTint(isAlbum: isAlbum) : Color.secondary)
.padding(4)
.contentShape(.rect)
}
@@ -53,7 +61,7 @@ struct InfoNote: View {
// The button takes clicks across its own frame, 4 points around the glyph; the layout keeps the glyph's.
.padding(-4)
.accessibilityLabel(isMarked ? Text("A caution about \(name)") : Text("What \(name) is for"))
- .popover(isPresented: $isOpen, arrowEdge: .bottom) {
+ .popover(isPresented: isOpen, arrowEdge: .bottom) {
NoteCard(name: name, detail: detail(), symbol: symbol ?? mark, footnote: footnote, isAlbum: isAlbum)
}
}
diff --git a/Peel/Views/ItemMenu.swift b/Peel/Views/ItemMenu.swift
index a91dbc05..a6404193 100644
--- a/Peel/Views/ItemMenu.swift
+++ b/Peel/Views/ItemMenu.swift
@@ -13,8 +13,15 @@ struct ItemMenu: View {
/// The identifier of the app itself, when the row is one.
var appIdentifier: String?
var isExcluded = false
+ /// Opens the row's note, which a keyboard or VoiceOver reaches here, since its button in the row takes no
+ /// keyboard focus.
+ var showNote: (() -> Void)?
var body: some View {
+ if let showNote {
+ Button("Show Note", systemImage: "info.circle", action: showNote)
+ Divider()
+ }
Button("Show in Finder", systemImage: "folder") {
NSWorkspace.shared.activateFileViewerSelecting([url])
}
diff --git a/Peel/Views/RemovalRow.swift b/Peel/Views/RemovalRow.swift
index eb21e9de..89846c45 100644
--- a/Peel/Views/RemovalRow.swift
+++ b/Peel/Views/RemovalRow.swift
@@ -49,6 +49,11 @@ struct RemovalRow: View {
}
@State private var isCompact = false
+ @State private var isNoteOpen = false
+
+ private var hasNote: Bool {
+ hasNoteColumn && (detail != nil || warning != nil)
+ }
var body: some View {
HStack(spacing: 6) {
@@ -62,7 +67,7 @@ struct RemovalRow: View {
proxy.size.width < limit
} action: { isCompact = $0 }
.contextMenu {
- ItemMenu(url: url, appIdentifier: appIdentifier, isExcluded: isExcluded)
+ ItemMenu(url: url, appIdentifier: appIdentifier, isExcluded: isExcluded, showNote: hasNote ? { isNoteOpen = true } : nil)
}
}
@@ -71,7 +76,8 @@ struct RemovalRow: View {
NativeCheckbox(
isOn: Binding(get: { isSelected }, set: { selection.setSelected($0, for: url) }),
label: spokenItem,
- hint: warning.map { String(Self.commandsMarked($0).characters) }
+ // What the note says, since its button takes no keyboard focus.
+ hint: detail != nil || warning != nil ? String(explanation.characters) : nil
)
clickableItem
.checkboxTitle()
@@ -217,7 +223,8 @@ struct RemovalRow: View {
detail: Text(explanation),
footnote: Text(verbatim: url.path(percentEncoded: false)),
isMarked: warning != nil,
- isInRow: true
+ isInRow: true,
+ opening: $isNoteOpen
)
} else {
blank