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