removed test fix for unblur on unfocus

This commit is contained in:
Daniel Haller 2024-04-30 03:36:26 +02:00
parent b460043c17
commit e887064533

View File

@ -39,22 +39,17 @@ function createWindow() {
fullscreen: false, fullscreen: false,
maximizable: false, maximizable: false,
vibrancy: 'fullscreen-ui', vibrancy: 'fullscreen-ui',
// Not working when unfocusing the window somehow?
backgroundMaterial: 'acrylic', backgroundMaterial: 'acrylic',
show: false show: false
}) })
mainWindow.on('blur', () => { // Show window after loading page
mainWindow.setBackgroundColor('#00000000')
})
mainWindow.on('focus', () => {
mainWindow.setBackgroundColor('#00000000')
})
mainWindow.once('ready-to-show', () => { mainWindow.once('ready-to-show', () => {
mainWindow.show() mainWindow.show()
}) })
// Closes all windows if mainwindow is being closed
mainWindow.on('closed', () => { mainWindow.on('closed', () => {
app.quit() app.quit()
}) })
@ -152,16 +147,13 @@ ipcMain.handle('dialog:defaultDirectory', async () => {
return savedPath return savedPath
}) })
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => { app.on('window-all-closed', () => {
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
app.quit() app.quit()
} }
}) })
const openWindows = new Map(); const openWindows = new Map()
// Open New Window // Open New Window
ipcMain.handle( ipcMain.handle(
@ -176,9 +168,9 @@ ipcMain.handle(
} }
) => { ) => {
if (openWindows.has(opt.title)) { if (openWindows.has(opt.title)) {
const existingWindow = openWindows.get(opt.title); const existingWindow = openWindows.get(opt.title)
existingWindow.focus(); existingWindow.focus()
return; return
} }
const newWindow = new BrowserWindow({ const newWindow = new BrowserWindow({
@ -204,18 +196,18 @@ ipcMain.handle(
vibrancy: 'fullscreen-ui', vibrancy: 'fullscreen-ui',
backgroundMaterial: 'acrylic', backgroundMaterial: 'acrylic',
show: false show: false
}); })
newWindow.once('ready-to-show', () => { newWindow.once('ready-to-show', () => {
newWindow.show(); newWindow.show()
}); })
newWindow.loadURL(opt.url); newWindow.loadURL(opt.url)
openWindows.set(opt.title, newWindow); openWindows.set(opt.title, newWindow)
newWindow.on('closed', () => { newWindow.on('closed', () => {
openWindows.delete(opt.title); openWindows.delete(opt.title)
}); })
} }
); )