fix paste delay not being saved
This commit is contained in:
parent
714ce0c270
commit
c6576aca44
4 changed files with 20 additions and 0 deletions
|
|
@ -337,6 +337,7 @@ pub fn run(cli_args: CliArgs) {
|
||||||
shortcut::change_debug_mode_setting,
|
shortcut::change_debug_mode_setting,
|
||||||
shortcut::change_word_correction_threshold_setting,
|
shortcut::change_word_correction_threshold_setting,
|
||||||
shortcut::change_extra_recording_buffer_setting,
|
shortcut::change_extra_recording_buffer_setting,
|
||||||
|
shortcut::change_paste_delay_ms_setting,
|
||||||
shortcut::change_paste_method_setting,
|
shortcut::change_paste_method_setting,
|
||||||
shortcut::get_available_typing_tools,
|
shortcut::get_available_typing_tools,
|
||||||
shortcut::change_typing_tool_setting,
|
shortcut::change_typing_tool_setting,
|
||||||
|
|
|
||||||
|
|
@ -669,6 +669,15 @@ pub fn change_extra_recording_buffer_setting(app: AppHandle, ms: u64) -> Result<
|
||||||
Ok(())
|
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]
|
#[tauri::command]
|
||||||
#[specta::specta]
|
#[specta::specta]
|
||||||
pub fn change_paste_method_setting(app: AppHandle, method: String) -> Result<(), String> {
|
pub fn change_paste_method_setting(app: AppHandle, method: String) -> Result<(), String> {
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,14 @@ async changeExtraRecordingBufferSetting(ms: number) : Promise<Result<null, strin
|
||||||
else return { status: "error", error: e as any };
|
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>> {
|
async changePasteMethodSetting(method: string) : Promise<Result<null, string>> {
|
||||||
try {
|
try {
|
||||||
return { status: "ok", data: await TAURI_INVOKE("change_paste_method_setting", { method }) };
|
return { status: "ok", data: await TAURI_INVOKE("change_paste_method_setting", { method }) };
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,8 @@ const settingUpdaters: {
|
||||||
custom_words: (value) => commands.updateCustomWords(value as string[]),
|
custom_words: (value) => commands.updateCustomWords(value as string[]),
|
||||||
word_correction_threshold: (value) =>
|
word_correction_threshold: (value) =>
|
||||||
commands.changeWordCorrectionThresholdSetting(value as number),
|
commands.changeWordCorrectionThresholdSetting(value as number),
|
||||||
|
paste_delay_ms: (value) =>
|
||||||
|
commands.changePasteDelayMsSetting(value as number),
|
||||||
paste_method: (value) => commands.changePasteMethodSetting(value as string),
|
paste_method: (value) => commands.changePasteMethodSetting(value as string),
|
||||||
typing_tool: (value) => commands.changeTypingToolSetting(value as string),
|
typing_tool: (value) => commands.changeTypingToolSetting(value as string),
|
||||||
external_script_path: (value) =>
|
external_script_path: (value) =>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue