Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

feat: Add disabled option for pasting. (#364)

Ole Jakob Schjøthc8389f34b2ce
diff --git a/src-tauri/src/clipboard.rs b/src-tauri/src/clipboard.rs
index 8b26c7e9..cc52119f 100644
--- a/src-tauri/src/clipboard.rs
+++ b/src-tauri/src/clipboard.rs
@@ -141,6 +141,10 @@ pub fn paste(text: String, app_handle: AppHandle) -> Result<(), String> {
// Perform the paste operation
match paste_method {
+ PasteMethod::None => {
+ // Intentionally do not perform any paste action; history/clipboard update
+ info!("PasteMethod::None selected - skipping paste action");
+ }
PasteMethod::CtrlV => paste_via_clipboard_ctrl_v(&text, &app_handle)?,
PasteMethod::Direct => paste_via_direct_input(&text)?,
PasteMethod::ShiftInsert => paste_via_clipboard_shift_insert(&text, &app_handle)?,
diff --git a/src-tauri/src/settings.rs b/src-tauri/src/settings.rs
index 8054d380..d5db7049 100644
--- a/src-tauri/src/settings.rs
+++ b/src-tauri/src/settings.rs
@@ -126,6 +126,7 @@ pub enum ModelUnloadTimeout {
pub enum PasteMethod {
CtrlV,
Direct,
+ None,
ShiftInsert,
}
diff --git a/src-tauri/src/shortcut.rs b/src-tauri/src/shortcut.rs
index fb03031b..e070e446 100644
--- a/src-tauri/src/shortcut.rs
+++ b/src-tauri/src/shortcut.rs
@@ -285,6 +285,7 @@ pub fn change_paste_method_setting(app: AppHandle, method: String) -> Result<(),
let parsed = match method.as_str() {
"ctrl_v" => PasteMethod::CtrlV,
"direct" => PasteMethod::Direct,
+ "none" => PasteMethod::None,
"shift_insert" => PasteMethod::ShiftInsert,
other => {
warn!("Invalid paste method '{}', defaulting to ctrl_v", other);
diff --git a/src/bindings.ts b/src/bindings.ts
index 1259c240..ffd2ef54 100644
--- a/src/bindings.ts
+++ b/src/bindings.ts
@@ -607,7 +607,7 @@ export type ModelInfo = { id: string; name: string; description: string; filenam
export type ModelLoadStatus = { is_loaded: boolean; current_model: string | null }
export type ModelUnloadTimeout = "never" | "immediately" | "min_2" | "min_5" | "min_10" | "min_15" | "hour_1" | "sec_5"
export type OverlayPosition = "none" | "top" | "bottom"
-export type PasteMethod = "ctrl_v" | "direct" | "shift_insert"
+export type PasteMethod = "ctrl_v" | "direct" | "none" | "shift_insert"
export type PostProcessProvider = { id: string; label: string; base_url: string; allow_base_url_edit?: boolean; models_endpoint?: string | null }
export type RecordingRetentionPeriod = "never" | "preserve_limit" | "days_3" | "weeks_2" | "months_3"
export type ShortcutBinding = { id: string; name: string; description: string; default_binding: string; current_binding: string }
diff --git a/src/components/settings/PasteMethod.tsx b/src/components/settings/PasteMethod.tsx
index 89807fde..10297acd 100644
--- a/src/components/settings/PasteMethod.tsx
+++ b/src/components/settings/PasteMethod.tsx
@@ -14,6 +14,7 @@ const getPasteMethodOptions = (osType: string) => {
const baseOptions = [
{ value: "ctrl_v", label: "Clipboard (Ctrl+V)" },
{ value: "direct", label: "Direct" },
+ { value: "none", label: "None" },
];
// Add Shift+Insert option for Windows and Linux only
@@ -44,7 +45,7 @@ export const PasteMethodSetting: React.FC<PasteMethodProps> = React.memo(
return (
<SettingContainer
title="Paste Method"
- description="Clipboard (Ctrl+V) simulates Ctrl/Cmd+V keystrokes to paste from your clipboard. Direct tries to use system input methods if possible, otherwise inputs keystrokes one by one into the text field. Clipboard (Shift+Insert) uses the more universal Shift+Insert shortcut, ideal for terminal applications and SSH clients."
+ description="Ctrl+V: 'pastes' via ctrl+v. Direct: type text directly. Shift+Insert: pastes via shift+insert. None: skip paste; just update history/clipboard."
descriptionMode={descriptionMode}
grouped={grouped}
tooltipPosition="bottom"