Skip to main content

toggle_webcam_bubble

Function toggle_webcam_bubble 

Source
pub fn toggle_webcam_bubble(app: AppHandle, state: State<'_, BubbleState>)
Expand description

Webcam-bubble toggle command (M-BUBBLE.0 / AUT-273).

Resolves the bound bubble window by its tauri.conf.json label (webcam-bubble), advances the state machine, then performs the corresponding show()/hide() on the window. Returns () to match the existing tray-toggle command shape — failures log via tracing::warn! so the click is never user-facing silent.

Persistence (M-BUBBLE.3 / AUT-276): on Show, restore the last remembered position (in-memory or, if first show of the session, loaded from bubble-position.txt in the app’s config dir). On Hide, snapshot the window’s current position into the in-memory state and persist to disk so a future app launch reopens at the same spot.

Notably does NOT call set_focus() on show — the bubble is a peripheral overlay and shouldn’t steal focus from the AppShell.