Skip to content

When minimizing and maximizing right afterwards the app is blank #39

Description

@notAperson535

After maximizing the app after minimizing, there is no content on the screen (Electron version 29.3.3):
image

const { app, BrowserWindow } = require('electron')
const { PARAMS, VALUE, MicaBrowserWindow, IS_WINDOWS_11, WIN10 } = require('mica-electron');
const path = require('node:path')

const createWindow = () => {
    const mainWindow = new MicaBrowserWindow({
        // titleBarStyle: "hidden",
        // titleBarOverlay: true,
        titleBarStyle: 'default',
        width: 800,
        height: 600,
        show: false,
        webPreferences: {
            webviewTag: true,
            preload: path.join(__dirname, 'preload.js'),
            sandbox: false
        }
    })

    mainWindow.setLightTheme()
    mainWindow.setMicaEffect()
    mainWindow.setRoundedCorner()
    mainWindow.alwaysFocused(true)

    mainWindow.webContents.once('dom-ready', () => {
        mainWindow.show();
    });

    mainWindow.webContents.on("did-attach-webview", (_, contents) => {
        contents.setWindowOpenHandler((details) => {
            mainWindow.webContents.send('open-url', details.url);
            return { action: 'deny' }
        })
    })

    mainWindow.loadFile('index.html')
}

app.whenReady().then(() => {
    createWindow()

    app.on('activate', () => {
        if (BrowserWindow.getAllWindows().length === 0) createWindow()
    })
})

app.on('window-all-closed', () => {
    if (process.platform !== 'darwin') app.quit()
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions