Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebUI on MacOS 14.6 doesn't quit the app after closing last Webview window #71

Open
marad opened this issue Oct 29, 2024 · 8 comments
Open
Labels
bug Something isn't working

Comments

@marad
Copy link

marad commented Oct 29, 2024

I think the title says it all. I'm running the on hash 1220f7cb9608ca0b5946bee76bb9fe3867aa5cab47990d9cf02339d89dc7ae1d9a32.

I'm trying to think of any other way to capture the window closing event but can't figure it out.

// Edit
I did some tests. I checked that Firefox and Chrome work fine. Safari doesn't start at all. And the "no quitting" problem seems to be related to webui.Brrowser.Webview.

I've also noticed that if I bind all events (with "") in Webview it doesn't pass through any - this might be connected.

Anyway - I'm going to use webui.Browser.ChromiumBased and it should work for my use case.

@marad marad changed the title WebUI on MacOS 14.6 doesn't quit the app after closing last window WebUI on MacOS 14.6 doesn't quit the app after closing last Webview window Oct 29, 2024
@jinzhongjia
Copy link
Collaborator

Sorry, I can't debug this problem at the moment because I don't have a mac
But we can temporarily mark the issue as

@jinzhongjia jinzhongjia added the bug Something isn't working label Oct 29, 2024
@marad
Copy link
Author

marad commented Oct 29, 2024

I think that there is a value in having this just hanging here for now. If anyone encounters the same problem the description also outlines the "workaround" so might be helpful in that way.

@AlbertShown
Copy link
Contributor

if I bind all events (with "") in Webview it doesn't pass through any

webui use websockets, it does not use webview APIs, so you need to make sure you are including webui.js in your webview HTML, and also hit F12 and make sure the webui.js http request is 200.

doesn't quit the app after closing last Webview window

webui does not track webview window using APIs, but it tracks how many websocket clients are connected, so when you close the window, maybe macOS keep websocket connection open or something... Another thing, webui will always stay connected if you set timeout to 0 (webui_set_timeout(0);).

I'm trying to think of any other way to capture the window closing event

All events including open and close are inside bind all events (with ""), but it seems you don't get any for some reason.

@AlbertShown
Copy link
Contributor

Can you use the debug version of webui to see logs?

@marad
Copy link
Author

marad commented Oct 30, 2024

@AlbertShown should I change something in the dependencies to use the debug version?

@AlbertShown
Copy link
Contributor

I don't know if Zig build have a debug option, but you can manually download webui lib, then copy the one from debug folder and replace your Zig project with it.

@mochalins
Copy link
Contributor

should I change something in the dependencies to use the debug version?

This is actually quite a good point, the Zig webui wrapper should support building and using the debug version of the library. I'll create a separate issue to track this.

@mochalins
Copy link
Contributor

Update: after #70, webui will now show logs when building in debug mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants