meslzy / electron-as-wallpaper

set your electron window as wallpaper behind desktop icons
MIT License
68 stars 10 forks source link

Black area on desktop after electron close #5

Closed ButzYung closed 1 year ago

ButzYung commented 1 year ago

After the electron window has been attached to the desktop, the area where the electron app is displayed will be left black after the app quits. The only way to prevent it is to refresh() the window before the app quits (on BrowserWindow's close event). Detaching the window without refresh() afterwards also cause the black area problem. Manually refeshing the desktop after the app quits doesn't restore the area. I have to actually change the desktop wallpaper to restore that black area.

meslzy commented 1 year ago

Can you please tell me what windows version u using? ( 10 or 11 ).

And the code where refresh function is used.

ButzYung commented 1 year ago

Windows 10 Home 22H2

The code is something like this

mainWindow.on("close", function () {
  refresh();
});

And whenever detach is used.

detach();
refresh();

If refresh is missing, the desktop area behind the electron window will become black.

meslzy commented 1 year ago

if u closed the window before detaching you will face the black screen 100%.

so if u call

detach();
refresh();

and it still result a black screen?

ButzYung commented 1 year ago

As long as the refresh() is there the desktop won't go black, even if you haven't detached the window before closing the app. Maybe you should update the readme and inform the users that they need to do so.

meslzy commented 1 year ago

I did mention it in the Readme but it wasn't clear why you should call refresh if u closed the window before detaching, I'll include it next commit.

Because no issue is here I'll close it, thanks.