Skip to content

armgit / Handy

Public Imported from GitHub
0

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

Add “Processing…” overlay state when post-processing (#740)

Anton Sotkov82d5c759ad9d
diff --git a/src-tauri/src/actions.rs b/src-tauri/src/actions.rs
index a26f060a..f15efc0b 100644
--- a/src-tauri/src/actions.rs
+++ b/src-tauri/src/actions.rs
@@ -7,7 +7,9 @@ use crate::managers::transcription::TranscriptionManager;
use crate::settings::{get_settings, AppSettings, APPLE_INTELLIGENCE_PROVIDER_ID};
use crate::shortcut;
use crate::tray::{change_tray_icon, TrayIconState};
-use crate::utils::{self, show_recording_overlay, show_transcribing_overlay};
+use crate::utils::{
+ self, show_processing_overlay, show_recording_overlay, show_transcribing_overlay,
+};
use crate::ManagedToggleState;
use ferrous_opencc::{config::BuiltinConfig, OpenCC};
use log::{debug, error};
@@ -341,6 +343,9 @@ impl ShortcutAction for TranscribeAction {
// Then apply LLM post-processing if this is the post-process hotkey
// Uses final_text which may already have Chinese conversion applied
+ if post_process {
+ show_processing_overlay(&ah);
+ }
let processed = if post_process {
post_process_transcription(&settings, &final_text).await
} else {
diff --git a/src-tauri/src/overlay.rs b/src-tauri/src/overlay.rs
index 5fa51a11..b08f650a 100644
--- a/src-tauri/src/overlay.rs
+++ b/src-tauri/src/overlay.rs
@@ -272,57 +272,39 @@ pub fn create_recording_overlay(app_handle: &AppHandle) {
}
}
-/// Shows the recording overlay window with fade-in animation
-pub fn show_recording_overlay(app_handle: &AppHandle) {
+fn show_overlay_state(app_handle: &AppHandle, state: &str) {
// Check if overlay should be shown based on position setting
let settings = settings::get_settings(app_handle);
if settings.overlay_position == OverlayPosition::None {
return;
}
- if let Some(overlay_window) = app_handle.get_webview_window("recording_overlay") {
- // Update position before showing to prevent flicker from position changes
- #[cfg(target_os = "linux")]
- {
- update_gtk_layer_shell_anchors(&overlay_window);
- }
-
- if let Some((x, y)) = calculate_overlay_position(app_handle) {
- let _ = overlay_window
- .set_position(tauri::Position::Logical(tauri::LogicalPosition { x, y }));
- }
+ update_overlay_position(app_handle);
+ if let Some(overlay_window) = app_handle.get_webview_window("recording_overlay") {
let _ = overlay_window.show();
// On Windows, aggressively re-assert "topmost" in the native Z-order after showing
#[cfg(target_os = "windows")]
force_overlay_topmost(&overlay_window);
- // Emit event to trigger fade-in animation with recording state
- let _ = overlay_window.emit("show-overlay", "recording");
+ let _ = overlay_window.emit("show-overlay", state);
}
}
+/// Shows the recording overlay window with fade-in animation
+pub fn show_recording_overlay(app_handle: &AppHandle) {
+ show_overlay_state(app_handle, "recording");
+}
+
/// Shows the transcribing overlay window
pub fn show_transcribing_overlay(app_handle: &AppHandle) {
- // Check if overlay should be shown based on position setting
- let settings = settings::get_settings(app_handle);
- if settings.overlay_position == OverlayPosition::None {
- return;
- }
-
- update_overlay_position(app_handle);
-
- if let Some(overlay_window) = app_handle.get_webview_window("recording_overlay") {
- let _ = overlay_window.show();
-
- // On Windows, aggressively re-assert "topmost" in the native Z-order after showing
- #[cfg(target_os = "windows")]
- force_overlay_topmost(&overlay_window);
+ show_overlay_state(app_handle, "transcribing");
+}
- // Emit event to switch to transcribing state
- let _ = overlay_window.emit("show-overlay", "transcribing");
- }
+/// Shows the processing overlay window
+pub fn show_processing_overlay(app_handle: &AppHandle) {
+ show_overlay_state(app_handle, "processing");
}
/// Updates the overlay window position based on current settings
diff --git a/src/i18n/locales/ar/translation.json b/src/i18n/locales/ar/translation.json
index 18bbe145..7a4e59bb 100644
--- a/src/i18n/locales/ar/translation.json
+++ b/src/i18n/locales/ar/translation.json
@@ -497,6 +497,7 @@
"description": "تغيير لغة واجهة Handy"
},
"overlay": {
- "transcribing": "...جاري التفريغ"
+ "transcribing": "...جاري التفريغ",
+ "processing": "...جاري المعالجة"
}
}
diff --git a/src/i18n/locales/cs/translation.json b/src/i18n/locales/cs/translation.json
index 4f671296..5bd50b04 100644
--- a/src/i18n/locales/cs/translation.json
+++ b/src/i18n/locales/cs/translation.json
@@ -497,6 +497,7 @@
"description": "Změňte jazyk rozhraní Handy"
},
"overlay": {
- "transcribing": "Přepisuji..."
+ "transcribing": "Přepisuji...",
+ "processing": "Zpracovávám..."
}
}
diff --git a/src/i18n/locales/de/translation.json b/src/i18n/locales/de/translation.json
index 4085e5c3..9a6b676b 100644
--- a/src/i18n/locales/de/translation.json
+++ b/src/i18n/locales/de/translation.json
@@ -497,6 +497,7 @@
"description": "Sprache der Handy-Oberfläche ändern"
},
"overlay": {
- "transcribing": "Transkribiere..."
+ "transcribing": "Transkribiere...",
+ "processing": "Verarbeite..."
}
}
diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json
index 58d842d1..c6c28411 100644
--- a/src/i18n/locales/en/translation.json
+++ b/src/i18n/locales/en/translation.json
@@ -497,6 +497,7 @@
"description": "Change the language of the Handy interface"
},
"overlay": {
- "transcribing": "Transcribing..."
+ "transcribing": "Transcribing...",
+ "processing": "Processing..."
}
}
diff --git a/src/i18n/locales/es/translation.json b/src/i18n/locales/es/translation.json
index 6ae8f86b..617d63c0 100644
--- a/src/i18n/locales/es/translation.json
+++ b/src/i18n/locales/es/translation.json
@@ -497,6 +497,7 @@
"description": "Cambia el idioma de la interfaz de Handy"
},
"overlay": {
- "transcribing": "Transcribiendo..."
+ "transcribing": "Transcribiendo...",
+ "processing": "Procesando..."
}
}
diff --git a/src/i18n/locales/fr/translation.json b/src/i18n/locales/fr/translation.json
index 826412d5..47f0b0ee 100644
--- a/src/i18n/locales/fr/translation.json
+++ b/src/i18n/locales/fr/translation.json
@@ -497,6 +497,7 @@
"description": "Changer la langue de l'interface de Handy"
},
"overlay": {
- "transcribing": "Transcription..."
+ "transcribing": "Transcription...",
+ "processing": "Traitement..."
}
}
diff --git a/src/i18n/locales/it/translation.json b/src/i18n/locales/it/translation.json
index ae8fae49..cac1cbfa 100644
--- a/src/i18n/locales/it/translation.json
+++ b/src/i18n/locales/it/translation.json
@@ -497,6 +497,7 @@
"description": "Cambia la lingua dell'interfaccia di Handy"
},
"overlay": {
- "transcribing": "Trascrizione..."
+ "transcribing": "Trascrizione...",
+ "processing": "Elaborazione..."
}
}
diff --git a/src/i18n/locales/ja/translation.json b/src/i18n/locales/ja/translation.json
index 503b77ba..bdf30a83 100644
--- a/src/i18n/locales/ja/translation.json
+++ b/src/i18n/locales/ja/translation.json
@@ -497,6 +497,7 @@
"description": "Handyインターフェースの言語を変更"
},
"overlay": {
- "transcribing": "文字起こし中..."
+ "transcribing": "文字起こし中...",
+ "processing": "処理中..."
}
}
diff --git a/src/i18n/locales/ko/translation.json b/src/i18n/locales/ko/translation.json
index aa18e95f..38603f48 100644
--- a/src/i18n/locales/ko/translation.json
+++ b/src/i18n/locales/ko/translation.json
@@ -497,6 +497,7 @@
"description": "Handy 인터페이스의 언어를 변경하세요"
},
"overlay": {
- "transcribing": "텍스트로 변환 중..."
+ "transcribing": "텍스트로 변환 중...",
+ "processing": "처리 중..."
}
}
diff --git a/src/i18n/locales/pl/translation.json b/src/i18n/locales/pl/translation.json
index 8c89e4be..6a51452f 100644
--- a/src/i18n/locales/pl/translation.json
+++ b/src/i18n/locales/pl/translation.json
@@ -497,6 +497,7 @@
"description": "Zmień język interfejsu Handy"
},
"overlay": {
- "transcribing": "Transkrypcja..."
+ "transcribing": "Transkrypcja...",
+ "processing": "Przetwarzanie..."
}
}
diff --git a/src/i18n/locales/pt/translation.json b/src/i18n/locales/pt/translation.json
index 887917f9..db2cf943 100644
--- a/src/i18n/locales/pt/translation.json
+++ b/src/i18n/locales/pt/translation.json
@@ -497,6 +497,7 @@
"description": "Alterar o idioma da interface do Handy"
},
"overlay": {
- "transcribing": "Transcrevendo..."
+ "transcribing": "Transcrevendo...",
+ "processing": "Processando..."
}
}
diff --git a/src/i18n/locales/ru/translation.json b/src/i18n/locales/ru/translation.json
index ec71884d..98645d81 100644
--- a/src/i18n/locales/ru/translation.json
+++ b/src/i18n/locales/ru/translation.json
@@ -497,6 +497,7 @@
"description": "Изменить языка интерфейса Handy"
},
"overlay": {
- "transcribing": "Расшифровка..."
+ "transcribing": "Расшифровка...",
+ "processing": "Обработка..."
}
}
diff --git a/src/i18n/locales/tr/translation.json b/src/i18n/locales/tr/translation.json
index 192745fb..0271aa3e 100644
--- a/src/i18n/locales/tr/translation.json
+++ b/src/i18n/locales/tr/translation.json
@@ -497,6 +497,7 @@
"description": "Handy arayüzünün dilini değiştirin"
},
"overlay": {
- "transcribing": "Transkribe ediliyor..."
+ "transcribing": "Transkribe ediliyor...",
+ "processing": "İşleniyor..."
}
}
diff --git a/src/i18n/locales/uk/translation.json b/src/i18n/locales/uk/translation.json
index ad040e0b..25c58748 100644
--- a/src/i18n/locales/uk/translation.json
+++ b/src/i18n/locales/uk/translation.json
@@ -497,6 +497,7 @@
"description": "Змінити мову інтерфейсу Handy"
},
"overlay": {
- "transcribing": "Обробка..."
+ "transcribing": "Обробка...",
+ "processing": "Постобробка..."
}
}
diff --git a/src/i18n/locales/vi/translation.json b/src/i18n/locales/vi/translation.json
index c2a96996..076f31d1 100644
--- a/src/i18n/locales/vi/translation.json
+++ b/src/i18n/locales/vi/translation.json
@@ -497,6 +497,7 @@
"description": "Thay đổi ngôn ngữ giao diện của Handy"
},
"overlay": {
- "transcribing": "Đang chuyển đổi..."
+ "transcribing": "Đang chuyển đổi...",
+ "processing": "Đang xử lý..."
}
}
diff --git a/src/i18n/locales/zh/translation.json b/src/i18n/locales/zh/translation.json
index a30babdc..627957a1 100644
--- a/src/i18n/locales/zh/translation.json
+++ b/src/i18n/locales/zh/translation.json
@@ -497,6 +497,7 @@
"description": "更改 Handy 界面的语言"
},
"overlay": {
- "transcribing": "正在转录..."
+ "transcribing": "正在转录...",
+ "processing": "处理中..."
}
}
diff --git a/src/overlay/RecordingOverlay.tsx b/src/overlay/RecordingOverlay.tsx
index b90cdc20..67f354dd 100644
--- a/src/overlay/RecordingOverlay.tsx
+++ b/src/overlay/RecordingOverlay.tsx
@@ -11,7 +11,7 @@ import { commands } from "@/bindings";
import i18n, { syncLanguageFromSettings } from "@/i18n";
import { getLanguageDirection } from "@/lib/utils/rtl";
-type OverlayState = "recording" | "transcribing";
+type OverlayState = "recording" | "transcribing" | "processing";
const RecordingOverlay: React.FC = () => {
const { t } = useTranslation();
@@ -96,6 +96,9 @@ const RecordingOverlay: React.FC = () => {
{state === "transcribing" && (
<div className="transcribing-text">{t("overlay.transcribing")}</div>
)}
+ {state === "processing" && (
+ <div className="transcribing-text">{t("overlay.processing")}</div>
+ )}
</div>
<div className="overlay-right">