Skip to content

Commit

Permalink
Disable full screen mode on Linux (#3151)
Browse files Browse the repository at this point in the history
  • Loading branch information
devinbinnie authored Sep 24, 2024
1 parent 92a0eff commit ddecc42
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 32 deletions.
20 changes: 13 additions & 7 deletions src/main/menus/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export function createTemplate(config: Config, updateManager: UpdateManager) {
]);
}

const viewSubMenu = [{
const viewSubMenu: Electron.MenuItemConstructorOptions[] = [{
label: localizeMessage('main.menus.app.view.find', 'Find..'),
accelerator: 'CmdOrCtrl+F',
click() {
Expand All @@ -250,11 +250,17 @@ export function createTemplate(config: Config, updateManager: UpdateManager) {
session.defaultSession.clearCache();
ViewManager.reload();
},
}, {
role: 'togglefullscreen',
label: localizeMessage('main.menus.app.view.fullscreen', 'Toggle Full Screen'),
accelerator: isMac ? 'Ctrl+Cmd+F' : 'F11',
}, separatorItem, {
}];

if (process.platform !== 'linux') {
viewSubMenu.push({
role: 'togglefullscreen',
label: localizeMessage('main.menus.app.view.fullscreen', 'Toggle Full Screen'),
accelerator: isMac ? 'Ctrl+Cmd+F' : 'F11',
});
}

viewSubMenu.push(separatorItem, {
label: localizeMessage('main.menus.app.view.actualSize', 'Actual Size'),
role: 'resetZoom',
accelerator: 'CmdOrCtrl+0',
Expand Down Expand Up @@ -284,7 +290,7 @@ export function createTemplate(config: Config, updateManager: UpdateManager) {
}, separatorItem, {
label: localizeMessage('main.menus.app.view.devToolsSubMenu', 'Developer Tools'),
submenu: devToolsSubMenu,
}];
});

if (process.platform !== 'darwin' && process.platform !== 'win32') {
viewSubMenu.push(separatorItem);
Expand Down
6 changes: 5 additions & 1 deletion src/main/windows/mainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class MainWindow extends EventEmitter {

const windowOptions: BrowserWindowConstructorOptions = Object.assign({}, this.savedWindowState, {
title: app.name,
fullscreenable: true,
fullscreenable: process.platform !== 'linux',
show: false, // don't start the window until it is ready and only if it isn't hidden
paintWhenInitiallyHidden: true, // we want it to start painting to get info from the webapp
minWidth: MINIMUM_WINDOW_WIDTH,
Expand Down Expand Up @@ -231,6 +231,10 @@ export class MainWindow extends EventEmitter {
};

private shouldStartFullScreen = () => {
if (process.platform === 'linux') {
return false;
}

if (global?.args?.fullscreen !== undefined) {
return global.args.fullscreen;
}
Expand Down
50 changes: 26 additions & 24 deletions src/renderer/components/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -982,32 +982,34 @@ class SettingsPage extends React.PureComponent<Props, State> {
</FormCheck>,
);

options.push(
<FormCheck
key='inputStartInFullScreen'
>
<FormCheck.Input
type='checkbox'
id='inputStartInFullScreen'
ref={this.startInFullscreenRef}
checked={this.state.startInFullscreen}
onChange={this.handleChangeStartInFullscreen}
/>
<FormattedMessage
id='renderer.components.settingsPage.fullscreen'
defaultMessage='Open app in fullscreen'
/>
<FormText>
if (process.platform !== 'linux') {
options.push(
<FormCheck
key='inputStartInFullScreen'
>
<FormCheck.Input
type='checkbox'
id='inputStartInFullScreen'
ref={this.startInFullscreenRef}
checked={this.state.startInFullscreen}
onChange={this.handleChangeStartInFullscreen}
/>
<FormattedMessage
id='renderer.components.settingsPage.fullscreen.description'
defaultMessage='If enabled, the {appName} application will always open in full screen'
values={{
appName: this.state.appName,
}}
id='renderer.components.settingsPage.fullscreen'
defaultMessage='Open app in fullscreen'
/>
</FormText>
</FormCheck>,
);
<FormText>
<FormattedMessage
id='renderer.components.settingsPage.fullscreen.description'
defaultMessage='If enabled, the {appName} application will always open in full screen'
values={{
appName: this.state.appName,
}}
/>
</FormText>
</FormCheck>,
);
}

options.push(
<div
Expand Down

0 comments on commit ddecc42

Please sign in to comment.