From db1d0dcf52c10f69edd82538f7c67b019c40f271 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Fri, 23 Feb 2024 09:27:28 +0000 Subject: [PATCH] fix(electron): autohide menu bar on linux (#5890) --- packages/frontend/electron/src/main/main-window.ts | 3 ++- packages/frontend/electron/src/shared/utils.ts | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/frontend/electron/src/main/main-window.ts b/packages/frontend/electron/src/main/main-window.ts index cdf23271d..18df5a1b4 100644 --- a/packages/frontend/electron/src/main/main-window.ts +++ b/packages/frontend/electron/src/main/main-window.ts @@ -4,7 +4,7 @@ import { join } from 'node:path'; import { BrowserWindow, type CookiesSetDetails, nativeTheme } from 'electron'; import electronWindowState from 'electron-window-state'; -import { isMacOS, isWindows } from '../shared/utils'; +import { isLinux, isMacOS, isWindows } from '../shared/utils'; import { mainWindowOrigin } from './constants'; import { ensureHelperProcess } from './helper-process'; import { logger } from './logger'; @@ -49,6 +49,7 @@ async function createWindow(additionalArguments: string[]) { x: mainWindowState.x, y: mainWindowState.y, width: mainWindowState.width, + autoHideMenuBar: isLinux(), minWidth: 640, minHeight: 480, visualEffectState: 'active', diff --git a/packages/frontend/electron/src/shared/utils.ts b/packages/frontend/electron/src/shared/utils.ts index b7e7438b1..41e5bf65d 100644 --- a/packages/frontend/electron/src/shared/utils.ts +++ b/packages/frontend/electron/src/shared/utils.ts @@ -12,6 +12,10 @@ export const isWindows = () => { return process.platform === 'win32'; }; +export const isLinux = () => { + return process.platform === 'win32'; +}; + interface MessagePortLike { postMessage: (data: unknown) => void; addListener: (event: 'message', listener: (...args: any[]) => void) => void;