Restore copy to clipboard functionality

This commit is contained in:
Beingpax 2025-08-07 00:41:20 +05:45
parent 270caa95b0
commit cdd1783a4c
2 changed files with 9 additions and 1 deletions

View File

@ -18,6 +18,7 @@ struct SettingsView: View {
@State private var showResetOnboardingAlert = false
@State private var currentShortcut = KeyboardShortcuts.getShortcut(for: .toggleMiniRecorder)
@State private var isCustomCancelEnabled = false
@AppStorage("shouldPreserveClipboard") private var shouldPreserveClipboard = false
var body: some View {
ScrollView {
@ -131,6 +132,12 @@ struct SettingsView: View {
}
.toggleStyle(.switch)
.help("Automatically pause active media playback when recording starts and resume when recording stops")
Toggle(isOn: $shouldPreserveClipboard) {
Text("Preserve clipboard after paste")
}
.toggleStyle(.switch)
.help("After pasting the transcript, the clipboard will be restored to its previous content.")
}
}

View File

@ -27,6 +27,7 @@ class WhisperState: NSObject, ObservableObject {
@Published var clipboardMessage = ""
@Published var miniRecorderError: String?
@Published var shouldCancelRecording = false
@AppStorage("shouldPreserveClipboard") private var shouldPreserveClipboard = false
@Published var recorderType: String = UserDefaults.standard.string(forKey: "RecorderType") ?? "mini" {
didSet {
@ -355,7 +356,7 @@ class WhisperState: NSObject, ObservableObject {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
CursorPaster.pasteAtCursor(text, shouldPreserveClipboard: true)
CursorPaster.pasteAtCursor(text, shouldPreserveClipboard: self.shouldPreserveClipboard)
let powerMode = PowerModeManager.shared
if let activeConfig = powerMode.currentActiveConfiguration, activeConfig.isAutoSendEnabled {