Skip to content

Commit 74ae6b5

Browse files
authored
SDA-5024 Toggle fullscreen menu entry workaround on macOS (#2530)
1 parent e614d09 commit 74ae6b5

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
"cheerio": "v1.0.0-rc.12",
196196
"cross-env": "7.0.3",
197197
"del": "3.0.0",
198-
"electron": "39.5.1",
198+
"electron": "41.3.0",
199199
"electron-builder": "^26.3.1",
200200
"electron-devtools-installer": "^3.2.0",
201201
"electron-icon-maker": "0.0.5",

src/app/app-menu.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,14 +400,34 @@ export class AppMenu {
400400
'zoomOut',
401401
),
402402
this.buildSeparator(),
403-
this.assignRoleOrLabel({
404-
role: 'togglefullscreen',
405-
label: i18n.t('Toggle Full Screen')(),
406-
}),
403+
this.addToggleFullScreenMenuItem(),
407404
],
408405
};
409406
}
410407

408+
/**
409+
* Creates a menu item to toggle full screen with different implementation for windows and macOS due to the difference in how full screen is handled in both OS
410+
* @returns Menu item
411+
*/
412+
private addToggleFullScreenMenuItem(): Electron.MenuItemConstructorOptions {
413+
if (isWindowsOS) {
414+
return this.assignRoleOrLabel({
415+
role: 'togglefullscreen',
416+
label: i18n.t('Toggle Full Screen')(),
417+
});
418+
} else {
419+
return {
420+
label: i18n.t('Toggle Full Screen')(),
421+
accelerator: 'Ctrl+Command+F',
422+
click: (_item, focusedWindow) => {
423+
if (focusedWindow) {
424+
focusedWindow.setFullScreen(!focusedWindow.isFullScreen());
425+
}
426+
},
427+
};
428+
}
429+
}
430+
411431
/**
412432
* Builds menu items for window section
413433
*/

0 commit comments

Comments
 (0)