feat(tray): add transcribing state and update icons
This commit is contained in:
parent
3d9ab1d8be
commit
7f9244c512
5 changed files with 13 additions and 3 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
src-tauri/resources/tray_transcribing.png
Normal file
BIN
src-tauri/resources/tray_transcribing.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -77,7 +77,7 @@ impl ShortcutAction for TranscribeAction {
|
|||
let rm = Arc::clone(&app.state::<Arc<AudioRecordingManager>>());
|
||||
let tm = Arc::clone(&app.state::<Arc<TranscriptionManager>>());
|
||||
|
||||
change_tray_icon(app, TrayIconState::Idle);
|
||||
change_tray_icon(app, TrayIconState::Transcribing);
|
||||
|
||||
// Play audio feedback for recording stop
|
||||
play_recording_stop_sound(app);
|
||||
|
|
@ -112,23 +112,31 @@ impl ShortcutAction for TranscribeAction {
|
|||
let ah_clone = ah.clone();
|
||||
let paste_time = Instant::now();
|
||||
ah.run_on_main_thread(move || {
|
||||
match utils::paste(transcription_clone, ah_clone) {
|
||||
match utils::paste(transcription_clone, ah_clone.clone()) {
|
||||
Ok(()) => debug!(
|
||||
"Text pasted successfully in {:?}",
|
||||
paste_time.elapsed()
|
||||
),
|
||||
Err(e) => eprintln!("Failed to paste transcription: {}", e),
|
||||
}
|
||||
change_tray_icon(&ah_clone, TrayIconState::Idle);
|
||||
})
|
||||
.unwrap_or_else(|e| {
|
||||
eprintln!("Failed to run paste on main thread: {:?}", e);
|
||||
change_tray_icon(&ah, TrayIconState::Idle);
|
||||
});
|
||||
} else {
|
||||
change_tray_icon(&ah, TrayIconState::Idle);
|
||||
}
|
||||
}
|
||||
Err(err) => debug!("Global Shortcut Transcription error: {}", err),
|
||||
Err(err) => {
|
||||
debug!("Global Shortcut Transcription error: {}", err);
|
||||
change_tray_icon(&ah, TrayIconState::Idle);
|
||||
},
|
||||
}
|
||||
} else {
|
||||
debug!("No samples retrieved from recording stop");
|
||||
change_tray_icon(&ah, TrayIconState::Idle);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ pub fn paste(text: String, app_handle: AppHandle) -> Result<(), String> {
|
|||
pub enum TrayIconState {
|
||||
Idle,
|
||||
Recording,
|
||||
Transcribing,
|
||||
}
|
||||
|
||||
pub fn change_tray_icon(app: &AppHandle, icon: TrayIconState) {
|
||||
|
|
@ -81,6 +82,7 @@ pub fn change_tray_icon(app: &AppHandle, icon: TrayIconState) {
|
|||
let icon_path = match icon {
|
||||
TrayIconState::Idle => "resources/tray_idle.png",
|
||||
TrayIconState::Recording => "resources/tray_recording.png",
|
||||
TrayIconState::Transcribing => "resources/tray_transcribing.png",
|
||||
};
|
||||
|
||||
let _ = tray.set_icon(Some(
|
||||
|
|
|
|||
Loading…
Reference in a new issue