Open vindarel opened 2 months ago
Following your idea, this instead of webui-show
works:
(webui-show-browser w "<html>
<script src=\"webui.js\"></script>
Hello,
<button id=\"my-button\">world!</button>
</html>"
1)
the 1
is to open a Firefox window (it was a wild guess). I can see it, the button callback works.
but wait… it looks like trying to run it a second time does nothing. No error, no return value, no browser window. I restart the Lisp and I can run it once again.
To run it multiple times without issues, you must call webui-destroy
, this is demonstrated in call-js-from-lisp.lisp
.
I did not include it in the minimal example because the C example does not have it. Maybe I should since it is more likely for a Lisp user to start the window multiple times from a single process.
Exported the browser enum, now instead of 1 you can use +webui-any-browser+
, or +webui-firefox+
no more luck with webui-destroy
:/
I do
(defun minimal ()
(let ((w (webui-new-window)))
(webui-bind w "my-button"
(lambda (event)
(declare (ignore event))
(webui-run w "alert(\"hi\");")))
(webui-show-browser w "<html>
<script src=\"webui.js\"></script>
Hello,
<button id=\"my-button\">world!</button>
</html>"
+webui-chromium-based+) ;; with either Firefox or Chromium
(webui-wait)
(webui-destroy w)) ;; <---- destroy
)
a second call does nothing.
I'm not sure, I am able to call this exact function twice in a row, only difference is I used Firefox (no chromium installed)
Given:
(defun run ()
(let ((w (ui:webui-new-window)))
(ui:webui-show-browser w "<html>Hello, world!</html>" ui:+webui-firefox+)
(ui:webui-wait)
(ui:webui-destroy w)))
then
CL-USER> (webby::run)
; No values
and nothing appears in my browser. Firefox was already open, mind you, and I'm on Wayland with a tiling window manager. Any idea what the issue might be?
@fosskers I am not sure, are you able to run the dynamically linked examples in the webui repository? I am on X11, Gnome, Arch, and WebUI built from source, I will test on Wayland and see if that causes any issues.
Unfortunately I'm not able to get any windows to appear, either through Firefox or Chromium, and it's not clear why. (run)
just hangs without doing anything.
I have to mention that CLOG frame allows me to have a webview, easily. It is based on webview.h (and not tied to CLOG nor to CL).
I should perhaps mention that I'm on 2.5.0+beta.1
of webui.
@fosskers I was playing around with this today, the AUR package builds webui with make WEBUI_USE_TLS=1
which allows me to recreate this issue, if you do the default make target things will work fine. I will see if I can fix this in a better way, but changing your PKGBUILD or building from source is a workaround for now.
Same issue in the webui examples, I submitted an issue there https://github.com/webui-dev/webui/issues/454
Thanks! I'll test it again locally today.
These bindings are excellent and could be big for CL.
As we discussed though, I currently have errors when trying the examples :S
I'll add details, if anyone has an idea, thanks in advance.
I run this:
Versions
System version
it's old-ish
OS: Linux Mint 20 LTS x86_64 (Ubuntu Focal) Kernel: 5.4.0-176-generic gcc 9.4 GLIBC 2.31
Lisp versions
CFFI pulled today
SBCL 2.1.5, 2.4.1 and 2.4.5
CCL "Version 1.11-r16635 (LinuxX8664)"
webui C bindings
I built them with
make
, the minimal C example works (with a Makefile tweak, see their issues).