fix: unify PiP window creation through single frontend code path
Rust global shortcuts (Ctrl+1-5) now emit a pip:open event instead of creating windows directly, so geometry restore, loading spinner and state tracking all work regardless of how the PiP is opened.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use tauri::{
|
||||
menu::{Menu, MenuItem},
|
||||
tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent},
|
||||
Manager, WebviewWindowBuilder, WindowEvent,
|
||||
Emitter, Manager, WindowEvent,
|
||||
};
|
||||
use tauri_plugin_global_shortcut::{Code, GlobalShortcutExt, Modifiers, Shortcut, ShortcutState};
|
||||
|
||||
@@ -22,23 +22,8 @@ fn open_pip_terminal(app: &tauri::AppHandle, idx: u8) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create new PiP window — the page itself handles terminal connection or showing "new session" modal
|
||||
let url = format!("/transcript-debug/{}?pip=1", idx);
|
||||
let x = 1520.0_f64; // sensible default, will be near right edge on 1920px screens
|
||||
let y = 60.0 + (idx as f64 - 1.0) * 40.0;
|
||||
|
||||
let _ = WebviewWindowBuilder::new(
|
||||
app,
|
||||
&label,
|
||||
tauri::WebviewUrl::App(url.into()),
|
||||
)
|
||||
.title(&format!("T{} - Agent UI", idx))
|
||||
.inner_size(380.0, 620.0)
|
||||
.position(x, y)
|
||||
.decorations(false)
|
||||
.resizable(true)
|
||||
.focused(true)
|
||||
.build();
|
||||
// Delegate creation to frontend (handles geometry restore, loading spinner, state tracking)
|
||||
let _ = app.emit("pip:open", idx);
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
|
||||
Reference in New Issue
Block a user