feat #14740: start recording from the main window
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -355,12 +355,21 @@ pub fn show_main(app: &AppHandle) {
|
||||
show_and_focus(app, "main");
|
||||
}
|
||||
|
||||
/// Brings the floating window to the front (tray "Aufnahme manuell
|
||||
/// starten" while a recording runs).
|
||||
pub fn show_recorder(app: &AppHandle) {
|
||||
/// Brings the floating window to the front: the tray's "Aufnahme manuell
|
||||
/// starten" and the main window's record button both call this instead of
|
||||
/// starting a second recording when one is already running.
|
||||
pub fn focus_recorder(app: &AppHandle) {
|
||||
show_and_focus(app, "recorder");
|
||||
}
|
||||
|
||||
/// Main window record button while a recording already runs: shows/focuses
|
||||
/// the floating recorder window instead of starting another recording.
|
||||
/// Shares [`focus_recorder`] with the tray handler.
|
||||
#[tauri::command]
|
||||
pub fn show_recorder(app: AppHandle) {
|
||||
focus_recorder(&app);
|
||||
}
|
||||
|
||||
fn show_and_focus(app: &AppHandle, label: &str) {
|
||||
if let Some(window) = app.get_webview_window(label) {
|
||||
let _ = window.unminimize();
|
||||
|
||||
@@ -123,6 +123,7 @@ pub fn run() {
|
||||
commands::test_devices,
|
||||
commands::get_recording_state,
|
||||
commands::start_manual_recording,
|
||||
commands::show_recorder,
|
||||
commands::stop_recording,
|
||||
commands::discard_current_recording,
|
||||
commands::get_pending_prompt,
|
||||
|
||||
@@ -38,7 +38,7 @@ pub fn create(app: &AppHandle) -> tauri::Result<()> {
|
||||
app.state::<AppState>().recording_state(),
|
||||
RecordingState::Recording { .. }
|
||||
) {
|
||||
commands::show_recorder(app);
|
||||
commands::focus_recorder(app);
|
||||
return;
|
||||
}
|
||||
// Opening the audio devices can take a moment; keep the
|
||||
|
||||
Reference in New Issue
Block a user