From 3c21a05c3767dad6b32f6291f8e51927ec7f5e00 Mon Sep 17 00:00:00 2001 From: Linkon <116425752+Linkon-lcw@users.noreply.github.com> Date: Tue, 20 Jan 2026 02:28:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(window):=20=E4=BF=AE=E5=A4=8D=20Mica/Acryli?= =?UTF-8?q?c=20=E8=83=8C=E6=99=AF=E4=B8=8D=E9=80=8F=E6=98=8E=E5=8F=8A?= =?UTF-8?q?=E5=A4=B1=E7=84=A6=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/services/WindowManager.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/services/WindowManager.ts b/src/main/services/WindowManager.ts index 3cc2852..8e68065 100644 --- a/src/main/services/WindowManager.ts +++ b/src/main/services/WindowManager.ts @@ -98,6 +98,8 @@ export class WindowManager extends Service { show: false, autoHideMenuBar: true, frame: false, + transparent: true, + backgroundColor: '#00000000', icon: this.opts.icon, title: input.title, webPreferences: { @@ -161,6 +163,18 @@ export class WindowManager extends Service { win.webContents.send('window:maximized-changed', false) }) + win.on('blur', () => { + if (input.key === 'global-sidebar' || input.key === 'main') { + this.applyMicaEffect(win) + } + }) + + win.on('focus', () => { + if (input.key === 'global-sidebar' || input.key === 'main') { + this.applyMicaEffect(win) + } + }) + win.webContents.setWindowOpenHandler((details) => { shell.openExternal(details.url) return { action: 'deny' } @@ -226,7 +240,10 @@ export class WindowManager extends Service { } } - public setMicaEffect(win: BrowserWindow, effect: 'mica' | 'tabbed' | 'acrylic' | 'blur' | 'transparent' | 'none' = 'mica') { + public setMicaEffect( + win: BrowserWindow, + effect: 'mica' | 'tabbed' | 'acrylic' | 'blur' | 'transparent' | 'none' = 'mica' + ) { if (!micaElectron) return const micaWin = win as MicaWindow