Files
Lumotia/src-tauri/src/commands/windows.rs
jake 29ff91d3f6 feat(kon): wire Tauri shell — thin commands, ProviderRegistry, tray
- lib.rs rewritten from scaffold to full app setup (~70 lines)
- AppState holds Arc<LocalEngine> for Whisper and Parakeet
- commands/models.rs: download, check, list, load for both engines
  Maps legacy size strings (Tiny/Base/Small/Medium) to ModelId
- commands/transcription.rs: transcribe_pcm, transcribe_file, transcribe_pcm_parakeet
  Delegates to LocalEngine.transcribe_sync() + post_process_segments()
- commands/audio.rs: save_audio via kon_audio::write_wav
- commands/windows.rs: open_task_window, open_viewer_window
- commands/llm.rs: 8 stub commands preserved for frontend compatibility
- tray.rs: extracted system tray setup (show, status, quit, click-to-show)
- Close-to-tray behaviour preserved
- All 25 v0.2 command names preserved for Svelte frontend compatibility
- clippy clean

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 21:15:16 +00:00

59 lines
1.5 KiB
Rust

use tauri::{Emitter, Manager, WebviewUrl, WebviewWindowBuilder};
/// Open a floating always-on-top task window.
#[tauri::command]
pub async fn open_task_window(
app: tauri::AppHandle,
) -> Result<(), String> {
if let Some(window) = app.get_webview_window("tasks-float") {
window.show().map_err(|e| e.to_string())?;
window.set_focus().map_err(|e| e.to_string())?;
app.emit("task-window-focus", ())
.map_err(|e| e.to_string())?;
return Ok(());
}
WebviewWindowBuilder::new(
&app,
"tasks-float",
WebviewUrl::App("/float".into()),
)
.title("Kon Tasks")
.inner_size(480.0, 520.0)
.min_inner_size(400.0, 400.0)
.always_on_top(true)
.decorations(false)
.resizable(true)
.build()
.map_err(|e| e.to_string())?;
Ok(())
}
/// Open the transcript viewer window.
#[tauri::command]
pub async fn open_viewer_window(
app: tauri::AppHandle,
) -> Result<(), String> {
if let Some(window) = app.get_webview_window("transcript-viewer") {
window.show().map_err(|e| e.to_string())?;
window.set_focus().map_err(|e| e.to_string())?;
return Ok(());
}
WebviewWindowBuilder::new(
&app,
"transcript-viewer",
WebviewUrl::App("/viewer".into()),
)
.title("Kon - Viewer")
.inner_size(600.0, 700.0)
.min_inner_size(450.0, 500.0)
.decorations(false)
.resizable(true)
.build()
.map_err(|e| e.to_string())?;
Ok(())
}