@@ -94,7 +94,7 @@ function getToolsSubmenu(): MenuItemConstructorOptions[] {
94
94
accelerator :
95
95
process . platform === "darwin" ? "Alt+Command+I" : "Ctrl+Shift+I" ,
96
96
click ( _item , focusedWindow ) {
97
- if ( focusedWindow ) {
97
+ if ( focusedWindow && focusedWindow instanceof BrowserWindow ) {
98
98
focusedWindow . webContents . openDevTools ( { mode : "undocked" } ) ;
99
99
}
100
100
} ,
@@ -222,7 +222,7 @@ function getViewSubmenu(): MenuItemConstructorOptions[] {
222
222
{
223
223
label : t . __ ( "Toggle Tray Icon" ) ,
224
224
click ( _item , focusedWindow ) {
225
- if ( focusedWindow ) {
225
+ if ( focusedWindow && focusedWindow instanceof BrowserWindow ) {
226
226
send ( focusedWindow . webContents , "toggletray" ) ;
227
227
}
228
228
} ,
@@ -231,7 +231,7 @@ function getViewSubmenu(): MenuItemConstructorOptions[] {
231
231
label : t . __ ( "Toggle Sidebar" ) ,
232
232
accelerator : "CommandOrControl+Shift+S" ,
233
233
click ( _item , focusedWindow ) {
234
- if ( focusedWindow ) {
234
+ if ( focusedWindow && focusedWindow instanceof BrowserWindow ) {
235
235
const newValue = ! ConfigUtil . getConfigItem ( "showSidebar" , true ) ;
236
236
send ( focusedWindow . webContents , "toggle-sidebar" , newValue ) ;
237
237
ConfigUtil . setConfigItem ( "showSidebar" , newValue ) ;
@@ -243,7 +243,7 @@ function getViewSubmenu(): MenuItemConstructorOptions[] {
243
243
checked : ConfigUtil . getConfigItem ( "autoHideMenubar" , false ) ,
244
244
visible : process . platform !== "darwin" ,
245
245
click ( _item , focusedWindow ) {
246
- if ( focusedWindow ) {
246
+ if ( focusedWindow && focusedWindow instanceof BrowserWindow ) {
247
247
const newValue = ! ConfigUtil . getConfigItem ( "autoHideMenubar" , false ) ;
248
248
focusedWindow . autoHideMenuBar = newValue ;
249
249
focusedWindow . setMenuBarVisibility ( ! newValue ) ;
0 commit comments