Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron: Add 'Toggle Full Screen' Command #9399

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export namespace ElectronCommands {
id: 'close.window',
label: 'Close Window'
};
export const TOGGLE_FULL_SCREEN: Command = {
id: 'workbench.action.toggleFullScreen',
category: 'View',
label: 'Toggle Full Screen'
};
}

export namespace ElectronMenus {
Expand Down Expand Up @@ -182,6 +187,11 @@ export class ElectronMenuContribution implements FrontendApplicationContribution
registry.registerCommand(ElectronCommands.RESET_ZOOM, {
execute: () => this.preferenceService.set('window.zoomLevel', ZoomLevel.DEFAULT, PreferenceScope.User)
});
registry.registerCommand(ElectronCommands.TOGGLE_FULL_SCREEN, {
isEnabled: () => currentWindow.isFullScreenable(),
isVisible: () => currentWindow.isFullScreenable(),
execute: () => currentWindow.setFullScreen(!currentWindow.isFullScreen())
});
}

registerKeybindings(registry: KeybindingRegistry): void {
Expand Down Expand Up @@ -209,6 +219,10 @@ export class ElectronMenuContribution implements FrontendApplicationContribution
{
command: ElectronCommands.CLOSE_WINDOW.id,
keybinding: (isOSX ? 'cmd+shift+w' : (isWindows ? 'ctrl+w' : /* Linux */ 'ctrl+q'))
},
{
command: ElectronCommands.TOGGLE_FULL_SCREEN.id,
keybinding: isOSX ? 'ctrl+ctrlcmd+f' : 'f11'
}
);
}
Expand Down