Electron Win+D minimization issue on Windows

I want to make a software similar to a desktop sticky note and develop it using Electron. Currently, on the Windows side, I have encountered some problems:
1.Can Electron prevent minimization when Win+D is pressed?
2.If the problem of not being able to prevent minimization with Win+D cannot be solved, then after minimization, I created a background through the Tray that comes with Electron and set up an event.
tray.on('click', () => mainWindow.show())

The above code can run normally, but when I click on other areas of the desktop, my application is zoomed out again.
Or when I click on a third-party application in the taskbar, my application is also displayed normally.
I have seen some other solutions. For example:

mainWindow.on('minimize', (e) => {
    e.preventDefault()
    setTimeout(() => mainWindow.restore(), 200)
})

However, the listening of the above code is ineffective.

BTW: I set minimizable to false and alwaysOnTop is effective, but the user experience is not good.

Electron Version: 29.1.0

BrowserWindow

win = new BrowserWindow({
    type: "toolbar",
    frame: false,
    skipTaskbar: true,
    transparent: true,
    minimizable: false,
    ...
  });