From c2341d6697344b8bc8a412691fb0f9db52112ff8 Mon Sep 17 00:00:00 2001 From: 3gf8jv4dv <3gf8jv4dv@gmail.com> Date: Sat, 19 Apr 2025 19:54:43 +0800 Subject: [PATCH] Disable rounded corners for lyric window (#2356) * Disable rounded corners for lyric window Ensure that the lyric window looks the same on Windows 11 as it does on other systems. Ref: https://github.com/electron/electron/issues/46468 * update --------- Co-authored-by: lyswhut --- src/main/app.ts | 2 ++ src/main/modules/userApi/main.ts | 1 + src/main/modules/winLyric/main.ts | 1 + src/main/modules/winMain/main.ts | 4 ++-- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/app.ts b/src/main/app.ts index 5be425b3..13b40985 100644 --- a/src/main/app.ts +++ b/src/main/app.ts @@ -14,6 +14,8 @@ import { openDirInExplorer } from '@common/utils/electron' export const initGlobalData = () => { const envParams = parseEnvParams() + envParams.cmdParams.dt = !!envParams.cmdParams.dt + global.envParams = { cmdParams: envParams.cmdParams, deeplink: envParams.deeplink, diff --git a/src/main/modules/userApi/main.ts b/src/main/modules/userApi/main.ts index 2ea35096..96aad60b 100644 --- a/src/main/modules/userApi/main.ts +++ b/src/main/modules/userApi/main.ts @@ -77,6 +77,7 @@ export const createWindow = async(userApi: LX.UserApi.UserApiInfo) => { minimizable: false, maximizable: false, fullscreenable: false, + roundedCorners: false, hasShadow: false, show: false, webPreferences: { diff --git a/src/main/modules/winLyric/main.ts b/src/main/modules/winLyric/main.ts index 2b1faeb7..d4fed3c4 100644 --- a/src/main/modules/winLyric/main.ts +++ b/src/main/modules/winLyric/main.ts @@ -127,6 +127,7 @@ export const createWindow = () => { minimizable: false, maximizable: false, fullscreenable: false, + roundedCorners: false, show: false, alwaysOnTop: isAlwaysOnTop, skipTaskbar: !isShowTaskbar, diff --git a/src/main/modules/winMain/main.ts b/src/main/modules/winMain/main.ts index b6c3fd85..fc2d022d 100644 --- a/src/main/modules/winMain/main.ts +++ b/src/main/modules/winMain/main.ts @@ -87,7 +87,7 @@ export const createWindow = () => { resizable: false, maximizable: false, fullscreenable: true, - roundedCorners: false, + roundedCorners: global.envParams.cmdParams.dt, show: false, webPreferences: { session: ses, @@ -109,7 +109,7 @@ export const createWindow = () => { browserWindow = new BrowserWindow(options) const winURL = process.env.NODE_ENV !== 'production' ? 'http://localhost:9080' : `file://${path.join(encodePath(__dirname), 'index.html')}` - void browserWindow.loadURL(winURL + `?os=${getPlatform()}&dt=${!!global.envParams.cmdParams.dt}&dark=${shouldUseDarkColors}&theme=${encodeURIComponent(JSON.stringify(theme))}`) + void browserWindow.loadURL(winURL + `?os=${getPlatform()}&dt=${global.envParams.cmdParams.dt}&dark=${shouldUseDarkColors}&theme=${encodeURIComponent(JSON.stringify(theme))}`) winEvent()