Disable full screen mode on Linux (#3151)

This commit is contained in:
Devin Binnie
2024-09-24 09:47:38 -04:00
committed by GitHub
parent 92a0eff603
commit ddecc42233
3 changed files with 45 additions and 33 deletions

View File

@@ -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..'), label: localizeMessage('main.menus.app.view.find', 'Find..'),
accelerator: 'CmdOrCtrl+F', accelerator: 'CmdOrCtrl+F',
click() { click() {
@@ -250,11 +250,17 @@ export function createTemplate(config: Config, updateManager: UpdateManager) {
session.defaultSession.clearCache(); session.defaultSession.clearCache();
ViewManager.reload(); ViewManager.reload();
}, },
}, { }];
role: 'togglefullscreen',
label: localizeMessage('main.menus.app.view.fullscreen', 'Toggle Full Screen'), if (process.platform !== 'linux') {
accelerator: isMac ? 'Ctrl+Cmd+F' : 'F11', viewSubMenu.push({
}, separatorItem, { 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'), label: localizeMessage('main.menus.app.view.actualSize', 'Actual Size'),
role: 'resetZoom', role: 'resetZoom',
accelerator: 'CmdOrCtrl+0', accelerator: 'CmdOrCtrl+0',
@@ -284,7 +290,7 @@ export function createTemplate(config: Config, updateManager: UpdateManager) {
}, separatorItem, { }, separatorItem, {
label: localizeMessage('main.menus.app.view.devToolsSubMenu', 'Developer Tools'), label: localizeMessage('main.menus.app.view.devToolsSubMenu', 'Developer Tools'),
submenu: devToolsSubMenu, submenu: devToolsSubMenu,
}]; });
if (process.platform !== 'darwin' && process.platform !== 'win32') { if (process.platform !== 'darwin' && process.platform !== 'win32') {
viewSubMenu.push(separatorItem); viewSubMenu.push(separatorItem);

View File

@@ -74,7 +74,7 @@ export class MainWindow extends EventEmitter {
const windowOptions: BrowserWindowConstructorOptions = Object.assign({}, this.savedWindowState, { const windowOptions: BrowserWindowConstructorOptions = Object.assign({}, this.savedWindowState, {
title: app.name, 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 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 paintWhenInitiallyHidden: true, // we want it to start painting to get info from the webapp
minWidth: MINIMUM_WINDOW_WIDTH, minWidth: MINIMUM_WINDOW_WIDTH,
@@ -231,6 +231,10 @@ export class MainWindow extends EventEmitter {
}; };
private shouldStartFullScreen = () => { private shouldStartFullScreen = () => {
if (process.platform === 'linux') {
return false;
}
if (global?.args?.fullscreen !== undefined) { if (global?.args?.fullscreen !== undefined) {
return global.args.fullscreen; return global.args.fullscreen;
} }

View File

@@ -982,32 +982,34 @@ class SettingsPage extends React.PureComponent<Props, State> {
</FormCheck>, </FormCheck>,
); );
options.push( if (process.platform !== 'linux') {
<FormCheck options.push(
key='inputStartInFullScreen' <FormCheck
> key='inputStartInFullScreen'
<FormCheck.Input >
type='checkbox' <FormCheck.Input
id='inputStartInFullScreen' type='checkbox'
ref={this.startInFullscreenRef} id='inputStartInFullScreen'
checked={this.state.startInFullscreen} ref={this.startInFullscreenRef}
onChange={this.handleChangeStartInFullscreen} checked={this.state.startInFullscreen}
/> onChange={this.handleChangeStartInFullscreen}
<FormattedMessage
id='renderer.components.settingsPage.fullscreen'
defaultMessage='Open app in fullscreen'
/>
<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> <FormattedMessage
</FormCheck>, id='renderer.components.settingsPage.fullscreen'
); defaultMessage='Open app in fullscreen'
/>
<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( options.push(
<div <div