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.

VoiceOver hears Copied when a command is copied

Țugui Dragoșacc16f65889e
diff --git a/Peel/Views/CopyButton.swift b/Peel/Views/CopyButton.swift
index 40f0b4b4..0ea763df 100644
--- a/Peel/Views/CopyButton.swift
+++ b/Peel/Views/CopyButton.swift
@@ -1,3 +1,4 @@
+import Accessibility
import AppKit
import SwiftUI
@@ -17,6 +18,10 @@ struct CopyButton: View {
// The button exists to say the copy took, so it says so only when the pasteboard agrees.
NSPasteboard.general.clearContents()
copies = NSPasteboard.general.setString(text, forType: .string) ? copies + 1 : 0
+ // VoiceOver hears it too, since the word that changes is not where its cursor is.
+ if hasCopied {
+ AccessibilityNotification.Announcement(AttributedString(localized: "Copied")).post()
+ }
} label: {
Label {
// Both words are laid out and one is drawn, so the button keeps its width.