mirror of
https://github.com/SECTL/SecScore.git
synced 2026-07-21 18:19:03 +08:00
fix(window): 修复 Mica/Acrylic 背景不透明及失焦失效问题
This commit is contained in:
@@ -98,6 +98,8 @@ export class WindowManager extends Service {
|
|||||||
show: false,
|
show: false,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
frame: false,
|
frame: false,
|
||||||
|
transparent: true,
|
||||||
|
backgroundColor: '#00000000',
|
||||||
icon: this.opts.icon,
|
icon: this.opts.icon,
|
||||||
title: input.title,
|
title: input.title,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
@@ -161,6 +163,18 @@ export class WindowManager extends Service {
|
|||||||
win.webContents.send('window:maximized-changed', false)
|
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) => {
|
win.webContents.setWindowOpenHandler((details) => {
|
||||||
shell.openExternal(details.url)
|
shell.openExternal(details.url)
|
||||||
return { action: 'deny' }
|
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
|
if (!micaElectron) return
|
||||||
const micaWin = win as MicaWindow
|
const micaWin = win as MicaWindow
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user