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:
@@ -25,6 +25,7 @@ import { isTauri, isMobileTauri, getTauriNotification } from './lib/tauri'
|
||||
import { initApprovalNotifications } from './services/approvalNotifications'
|
||||
import { useServerConfig } from './stores/server-config'
|
||||
import { useApprovalWindow } from './composables/useApprovalWindow'
|
||||
import { usePipWindow } from './composables/usePipWindow'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
@@ -35,6 +36,7 @@ const showServerConfig = ref(false)
|
||||
const needsServerConfig = computed(() => isTauri && serverConfig && !serverConfig.isConfigured)
|
||||
|
||||
const isPipWindow = computed(() => route.query.pip === '1' || route.query.window === '1')
|
||||
let unlistenPipOpen: (() => void) | null = null
|
||||
const showVoice = ref(false)
|
||||
const showTranscriptDebug = ref(false)
|
||||
const showDebugConsole = ref(false)
|
||||
@@ -271,8 +273,15 @@ onMounted(async () => {
|
||||
fetchApprovalPending()
|
||||
|
||||
// Initialize native approval notifications (Tauri only)
|
||||
// Listen for PiP open requests from Rust global shortcuts (Ctrl+1-5)
|
||||
if (isTauri) {
|
||||
initApprovalNotifications()
|
||||
|
||||
const { listen } = await import('@tauri-apps/api/event')
|
||||
const { openPip } = usePipWindow()
|
||||
unlistenPipOpen = await listen<number>('pip:open', (event) => {
|
||||
openPip(event.payload)
|
||||
})
|
||||
}
|
||||
|
||||
// Connect centralized session state WS
|
||||
@@ -488,6 +497,7 @@ async function sendTestNotification() {
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener('mousemove', trackMouse)
|
||||
document.removeEventListener('keydown', handleGlobalKeydown)
|
||||
unlistenPipOpen?.()
|
||||
destroyTorch()
|
||||
disconnectApproval()
|
||||
destroySessionStateWS()
|
||||
|
||||
Reference in New Issue
Block a user