diff --git a/cinny b/cinny index 25fa0f6..146ba4d 160000 --- a/cinny +++ b/cinny @@ -1 +1 @@ -Subproject commit 25fa0f6ef9f4beed98d0b8dcb244523ac99077a9 +Subproject commit 146ba4d2ffb0ded4119af34736433a0eb89597f9 diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index c88e0ff..99bbb12 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -701,6 +701,34 @@ fn set_tray_update_ready(app: tauri::AppHandle, version: Option) -> Resu Ok(()) } +/// cinny-desktop #10: upload progress on the taskbar button (Windows taskbar; +/// the launcher/dock elsewhere, where Tauri supports it). `status` is `none`, +/// `normal`, `indeterminate` or `error`; `progress` is 0-100. The web side +/// aggregates every upload and throttles calls to ~4 Hz. +#[tauri::command] +fn set_taskbar_progress( + app: tauri::AppHandle, + status: String, + progress: Option, +) -> Result<(), String> { + use tauri::window::{ProgressBarState, ProgressBarStatus}; + let status = match status.as_str() { + "normal" => ProgressBarStatus::Normal, + "indeterminate" => ProgressBarStatus::Indeterminate, + "error" => ProgressBarStatus::Error, + _ => ProgressBarStatus::None, + }; + let window = app + .get_webview_window("main") + .ok_or_else(|| "no main window".to_string())?; + window + .set_progress_bar(ProgressBarState { + status: Some(status), + progress: progress.map(|p| p.min(100)), + }) + .map_err(|e| e.to_string()) +} + /// Flash the taskbar button to draw attention (e.g. a new mention while the /// window is unfocused). Clears automatically once the window is focused. #[tauri::command] @@ -750,6 +778,7 @@ pub fn run() { get_tray_dnd, set_tray_update_ready, set_tray_call_state, + set_taskbar_progress, flash_window, focus_main_window, send_notification,