@@ -94,7 +94,7 @@ function getToolsSubmenu(): MenuItemConstructorOptions[] {
9494 accelerator :
9595 process . platform === "darwin" ? "Alt+Command+I" : "Ctrl+Shift+I" ,
9696 click ( _item , focusedWindow ) {
97- if ( focusedWindow ) {
97+ if ( focusedWindow instanceof BrowserWindow ) {
9898 focusedWindow . webContents . openDevTools ( { mode : "undocked" } ) ;
9999 }
100100 } ,
@@ -222,7 +222,7 @@ function getViewSubmenu(): MenuItemConstructorOptions[] {
222222 {
223223 label : t . __ ( "Toggle Tray Icon" ) ,
224224 click ( _item , focusedWindow ) {
225- if ( focusedWindow ) {
225+ if ( focusedWindow instanceof BrowserWindow ) {
226226 send ( focusedWindow . webContents , "toggletray" ) ;
227227 }
228228 } ,
@@ -231,7 +231,7 @@ function getViewSubmenu(): MenuItemConstructorOptions[] {
231231 label : t . __ ( "Toggle Sidebar" ) ,
232232 accelerator : "CommandOrControl+Shift+S" ,
233233 click ( _item , focusedWindow ) {
234- if ( focusedWindow ) {
234+ if ( focusedWindow instanceof BrowserWindow ) {
235235 const newValue = ! ConfigUtil . getConfigItem ( "showSidebar" , true ) ;
236236 send ( focusedWindow . webContents , "toggle-sidebar" , newValue ) ;
237237 ConfigUtil . setConfigItem ( "showSidebar" , newValue ) ;
@@ -243,7 +243,7 @@ function getViewSubmenu(): MenuItemConstructorOptions[] {
243243 checked : ConfigUtil . getConfigItem ( "autoHideMenubar" , false ) ,
244244 visible : process . platform !== "darwin" ,
245245 click ( _item , focusedWindow ) {
246- if ( focusedWindow ) {
246+ if ( focusedWindow instanceof BrowserWindow ) {
247247 const newValue = ! ConfigUtil . getConfigItem ( "autoHideMenubar" , false ) ;
248248 focusedWindow . autoHideMenuBar = newValue ;
249249 focusedWindow . setMenuBarVisibility ( ! newValue ) ;
0 commit comments