@@ -807,13 +807,27 @@ if (ensureSingleInstance() && ensureCorrectEnvironment()) {
807807 mainWindow . setIcon ( appIcon ) ;
808808 }
809809
810- mainWindow . once ( 'ready-to-show' , ( ) => {
811- if ( ! mainWindow ) {
812- throw new Error ( '`mainWindow` is empty' ) ;
810+ // Reveal the window. `ready-to-show` is the preferred fast path, but on some
811+ // compositors (notably Wayland/mutter) that event can fail to fire, which
812+ // would otherwise leave the window hidden forever even though the page has
813+ // loaded. Guard the show in a once-only helper and back it with
814+ // `did-finish-load` and a timeout fallback so the window is always revealed.
815+ let hasShownMainWindow = false ;
816+ const showMainWindow = ( ) => {
817+ // `mainWindow` is never reset to null on close, so a destroyed window is
818+ // still a truthy reference; guard with `isDestroyed()` to avoid throwing
819+ // if a trigger fires after the window is gone. Latch the flag only after a
820+ // successful `show()` so a failed attempt doesn't block the other triggers.
821+ if ( hasShownMainWindow || ! mainWindow || mainWindow . isDestroyed ( ) ) {
822+ return ;
813823 }
814-
815824 mainWindow . show ( ) ;
816- } ) ;
825+ hasShownMainWindow = true ;
826+ } ;
827+
828+ mainWindow . once ( 'ready-to-show' , showMainWindow ) ;
829+ mainWindow . webContents . once ( 'did-finish-load' , showMainWindow ) ;
830+ setTimeout ( showMainWindow , 5000 ) ;
817831
818832 // don't show remote daeomn detials in the title bar
819833 if ( ! manageDaemonLifetime ( NET ) ) {
0 commit comments