fix paste delay not being saved

This commit is contained in:
CJ Pais 2026-03-26 08:33:58 +08:00
parent 714ce0c270
commit c6576aca44
4 changed files with 20 additions and 0 deletions

View file

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

View file

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

View file

@ -117,6 +117,14 @@ async changeExtraRecordingBufferSetting(ms: number) : Promise<Result<null, strin
else return { status: "error", error: e as any };
}
},
async changePasteDelayMsSetting(ms: number) : Promise<Result<null, string>> {
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<Result<null, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("change_paste_method_setting", { method }) };

View file

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