diff --git a/install_kiosk_0.9.5-10.sh b/install_kiosk_0.9.5-10.sh index 63acaa2..e2852ab 100644 --- a/install_kiosk_0.9.5-10.sh +++ b/install_kiosk_0.9.5-10.sh @@ -4040,12 +4040,26 @@ function unlockScreen(){ } // Restore current view using proper method + // For boot unlock, always use attachView for regular views (safe path) if(showingHidden&&hiddenViews[currentHiddenIndex]){ - const[w,h]=mainWindow.getContentSize(); - mainWindow.setTopBrowserView(hiddenViews[currentHiddenIndex]); - hiddenViews[currentHiddenIndex].setBounds({x:0,y:0,width:w,height:h}); - }else if(views[currentIndex]){ - attachView(currentIndex); + try{ + const[w,h]=mainWindow.getContentSize(); + // Ensure view is added to window before setting as top + mainWindow.addBrowserView(hiddenViews[currentHiddenIndex]); + mainWindow.setTopBrowserView(hiddenViews[currentHiddenIndex]); + hiddenViews[currentHiddenIndex].setBounds({x:0,y:0,width:w,height:h}); + }catch(e){ + console.error('[LOCKOUT] Error restoring hidden view:',e); + // Fallback to regular views + if(views.length>0){ + showingHidden=false; + attachView(0); + } + } + }else if(views.length>0){ + // Use valid index or default to 0 + const idx=(currentIndex>=0&¤tIndex