diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 238e8b9..98d689a 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -334,10 +334,32 @@ fn reveal_pet_window(app: &AppHandle, window: &tauri::WebviewWindow) -> Result<( window .set_always_on_top(true) .map_err(|error| error.to_string())?; - if let Some(monitor) = available_monitor_info(app)?.first() { + let monitors = available_monitor_info(app)?; + if let Some(monitor) = monitors.first() { place_pet_on_monitor(window, monitor, pet::PetPositionMode::Edge)?; } - window.show().map_err(|error| error.to_string()) + window.show().map_err(|error| error.to_string())?; + + // At default level on purpose. The window is transparent and undecorated, + // so "it did not appear" covers a window placed off-screen, a window that + // reports hidden, and a window that is there with nothing painted in it. + // Only the first two are visible from here, and they need no log filter to + // be worth reading. + let position = window.outer_position().ok(); + let size = window.outer_size().ok(); + tracing::info!( + target: "astrbot::pet", + monitors = monitors.len(), + monitor_work_area = monitors.first().map(|m| format!( + "{}x{}+{}+{}", + m.work_width, m.work_height, m.work_left, m.work_top + )).unwrap_or_else(|| "".into()).as_str(), + position = position.map(|p| format!("{},{}", p.x, p.y)).unwrap_or_else(|| "".into()).as_str(), + size = size.map(|s| format!("{}x{}", s.width, s.height)).unwrap_or_else(|| "".into()).as_str(), + visible = window.is_visible().unwrap_or(false), + "pet window revealed" + ); + Ok(()) } #[tauri::command] diff --git a/src/App.tsx b/src/App.tsx index a8d68e9..6605baf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -130,7 +130,18 @@ export function App() { }, [isBubbleView, isPetView, isQuickView, petDisplayMode]); if (isBubbleView) return ; - if (isPetView) return ; + // `DesktopPetView` is lazy and this branch returns before the shell's own + // boundary, so it had none. React 19 turned out to tolerate that — removing + // this wrapper still rendered the pet — so it is not the reason the floating + // pet does not appear. Kept because relying on that tolerance is not a + // contract, and the bubble and quick views already have their own. + if (isPetView) { + return ( + + + + ); + } if (isQuickView) { return (