diff --git a/docs/superpowers/plans/2026-05-08-browserlay-mvp.md b/docs/superpowers/plans/2026-05-08-browserlay-mvp.md index c4e5689..2a1ceea 100644 --- a/docs/superpowers/plans/2026-05-08-browserlay-mvp.md +++ b/docs/superpowers/plans/2026-05-08-browserlay-mvp.md @@ -1881,6 +1881,20 @@ pub fn get_hotkey_status(app: AppHandle) -> Result let guard = state.hotkey_status.lock().map_err(|_| "poisoned".to_string())?; Ok(guard.clone()) } + +/// Set window opacity. Tauri 2's JS WebviewWindow does NOT expose setOpacity +/// (only the Rust side does), so the JS layer routes through this command. +#[tauri::command] +pub fn set_window_opacity( + app: AppHandle, + label: String, + opacity: f32, +) -> Result<(), String> { + let Some(window) = app.get_webview_window(&label) else { + return Err(format!("window not found: {label}")); + }; + window.set_opacity(opacity).map_err(|e| e.to_string()) +} ``` > **Note on the design:** Tauri 2 doesn't expose a getter for `ignore_cursor_events` / `opacity` on `WebviewWindow`. Rather than rely on getters, we keep a tiny Rust-side cache (`AppState.click_through`) that the JS side keeps in sync via `sync_click_through_cache`. The global shortcut handler reads this cache, computes the inverse, calls `apply_state`. The JS-driven toggle path uses `toggle_click_through(current)` and skips the cache. @@ -1994,6 +2008,7 @@ pub fn run() { commands::overlay::toggle_click_through, commands::overlay::sync_click_through_cache, commands::overlay::get_hotkey_status, + commands::overlay::set_window_opacity, ]) .run(tauri::generate_context!()) .expect("error while running tauri application");