diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index a7e0728..45dd1df 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -337,6 +337,7 @@ pub fn run(cli_args: CliArgs) { shortcut::change_debug_mode_setting, shortcut::change_word_correction_threshold_setting, shortcut::change_extra_recording_buffer_setting, + shortcut::change_paste_delay_ms_setting, shortcut::change_paste_method_setting, shortcut::get_available_typing_tools, shortcut::change_typing_tool_setting, diff --git a/src-tauri/src/shortcut/mod.rs b/src-tauri/src/shortcut/mod.rs index 766b2b8..ac0c677 100644 --- a/src-tauri/src/shortcut/mod.rs +++ b/src-tauri/src/shortcut/mod.rs @@ -669,6 +669,15 @@ pub fn change_extra_recording_buffer_setting(app: AppHandle, ms: u64) -> Result< Ok(()) } +#[tauri::command] +#[specta::specta] +pub fn change_paste_delay_ms_setting(app: AppHandle, ms: u64) -> Result<(), String> { + let mut settings = settings::get_settings(&app); + settings.paste_delay_ms = ms; + settings::write_settings(&app, settings); + Ok(()) +} + #[tauri::command] #[specta::specta] pub fn change_paste_method_setting(app: AppHandle, method: String) -> Result<(), String> { diff --git a/src/bindings.ts b/src/bindings.ts index 21f7d6a..260cf9f 100644 --- a/src/bindings.ts +++ b/src/bindings.ts @@ -117,6 +117,14 @@ async changeExtraRecordingBufferSetting(ms: number) : Promise> { + try { + return { status: "ok", data: await TAURI_INVOKE("change_paste_delay_ms_setting", { ms }) }; +} catch (e) { + if(e instanceof Error) throw e; + else return { status: "error", error: e as any }; +} +}, async changePasteMethodSetting(method: string) : Promise> { try { return { status: "ok", data: await TAURI_INVOKE("change_paste_method_setting", { method }) }; diff --git a/src/stores/settingsStore.ts b/src/stores/settingsStore.ts index 9a4c9c0..4cbcc47 100644 --- a/src/stores/settingsStore.ts +++ b/src/stores/settingsStore.ts @@ -117,6 +117,8 @@ const settingUpdaters: { custom_words: (value) => commands.updateCustomWords(value as string[]), word_correction_threshold: (value) => commands.changeWordCorrectionThresholdSetting(value as number), + paste_delay_ms: (value) => + commands.changePasteDelayMsSetting(value as number), paste_method: (value) => commands.changePasteMethodSetting(value as string), typing_tool: (value) => commands.changeTypingToolSetting(value as string), external_script_path: (value) =>