mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-19 19:04:23 +08:00
fix(window): 修复 Mica/Acrylic 背景不透明及失焦失效问题
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user