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

* feat: Add disabled option for pasting.

* update bindings

* -> none

---------

Co-authored-by: CJ Pais <cj@cjpais.com>
This commit is contained in:
Ole Jakob Schjøth 2025-11-27 11:38:41 +01:00 committed by GitHub
parent 9521ab9332
commit c8389f34b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 9 additions and 2 deletions

View file

@ -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)?,

View file

@ -126,6 +126,7 @@ pub enum ModelUnloadTimeout {
pub enum PasteMethod {
CtrlV,
Direct,
None,
ShiftInsert,
}

View file

@ -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);

View file

@ -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 }

View file

@ -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"