We've been working on the new 0.4.0 version of Neel <https://github.com/Niminem/Neel> (A Nim library for making Electron-like HTML/JS GUI apps) that incorporates an additional UI option you can choose- the native webview.
The backend/frontend communication is virtually effortless, and having a native webview as the UI would be killer. As of now, the 0.3.0 version's only UI option is Chrome. Neel opens a new Chrome session in App Mode, which is awesome, but there's no way it can be used in a commercial application. Using webview though, now that opens up possibilities!
We have a development branch that has a working version of this capability, but it has only been tested on our machines. Webview is new and unexplored territory and to be quite honest, we're simply using Oska's Nim bindings <https://github.com/oskca/webview> of the v1.0 header file of this webview library <https://github.com/webview/webview>. I'm not sure of the limitations, potential, etc. of anything just yet.
I'd like to ask those of you that may have some time to spare, clone our new development branch <https://github.com/Niminem/Neel/tree/devel2> and run the FilePicker example (in the Examples directory). Let us know if you've had success or not and what OS/OS version you're using, and any feedback in general would be great.
When compiling the application, you must use --threads:on and -d:webview. If you'd like to test against Chrome, you can compile with -d:chrome instead.
There has been a few changes in how you write your Neel applications and the readme hasn't been updated yet. If you'd like to continue using this version until 0.4.0 is released:
Aside from the mentions above, 0.3.0 readme is accurate.
Thanks for your time
Out of curiosity, why not use the spread operator so that the arguments are treated as a varargs-like array implicitly, and you don't need to enclose them with an extra pair of brackets?
You have:
},
}
}
This could be "function (func, ...arr)" and then the result would be the same as if called with brackets
Tried testing on arch with nim head and 1.4.4. Getting an error from gcc/clang about missing webview.h.
I see webview.h in ~/.nimble/pkgs/neel-0.4.0 but looks like the generated -I in webview.nim is generating the incorrect path of -I/home/sage/.nimble/pkgs/neel-0.4.0/neel/webview. If I make that directory and copy webview.h there from /home/sage/.nimble/pkgs/neel-0.4.0/ then it compiles but when I run filePicker I get another error.
Maybe I'm trying to run the example incorrectly?
Compiled with nim c -d:release --gc:orc --threads:on -d:webview -f examples/filePicker.nim from Neel repo root dir.
Compiler error:
/home/sage/.cache/nim/filePicker_r/@m..@s..@[email protected]@[email protected]@sneel.nim.c:8:10: fatal error: webview.h: No such file or directory
8 | #include "webview.h"
| ^~~~~~~~~~~
compilation terminated.
Error: execution of an external compiler program 'gcc -c -w -fmax-errors=3 -pthread -DWEBVIEW_STATIC -DWEBVIEW_IMPLEMENTATION -I/home/sage/.nimble/pkgs/neel-0.4.0/neel/webview -DWEBVIEW_GTK=1 -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/lzo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -I/usr/include/webkitgtk-4.0 -I/usr/include/libsoup-2.4 -pthread -I/usr/include/libxml2 -O3 -fno-strict-aliasing -fno-ident -I'/home/sage/.choosenim/toolchains/nim-#devel/lib' -I/home/sage/build/Neel/examples -o /home/sage/.cache/nim/filePicker_r/@m..@s..@[email protected]@[email protected]@sneel.nim.c.o /home/sage/.cache/nim/filePicker_r/@m..@s..@[email protected]@[email protected]@sneel.nim.c' failed with exit code: 1
App error:
An error has occured in one of your routes.
Detail: io.nim(861) readFile
asyncfutures.nim(373) read
asyncfutures.nim(373) read
cannot open: /home/sage/.nimble/pkgs/neel-0.4.0/web/index.html
Same:
$ nimble install -y
...
$ nim --threads:on -d:webview r .\examples\filePicker.nim
...
C:\Users\moigagoo\nimcache\filePicker_d\@m..@s..@[email protected]@[email protected]@sneel.nim.c:12:10: fatal error: webview.h: No such file or directory
12 | #include "webview.h"
| ^~~~~~~~~~~
compilation terminated.
Error: execution of an external compiler program 'gcc.exe -c -w -fmax-errors=3 -mno-ms-bitfields -DWIN32_LEAN_AND_MEAN -DWEBVIEW_STATIC -DWEBVIEW_IMPLEMENTATION -IC:\Users\moigagoo\.nimble\pkgs\neel-0.4.0\neel\webview -DWEBVIEW_WINAPI=1 -IC:\Users\moigagoo\.choosenim\toolchains\nim-1.4.4\lib -IC:\Users\moigagoo\Projects\Neel\examples -o C:\Users\moigagoo\nimcache\filePicker_d\@m..@s..@[email protected]@[email protected]@sneel.nim.c.o C:\Users\moigagoo\nimcache\filePicker_d\@m..@s..@[email protected]@[email protected]@sneel.nim.c' failed with exit code: 1
Tested on Windows 10 64 bits, Nim devel 1.5.1 64 bits, backend c gcc 10.2.0.
I proceeded to the following steps:
6) I ran filePicker.exe and got this:
INFO Jester is making jokes at http://127.0.0.1:5000 (all interfaces)
ERROR io.nim(861) readFile
asyncfutures.nim(373) read
asyncfutures.nim(373) read
cannot open: C:\Users\Jose\.nimble\pkgs\neel-0.4.0\web\index.html
This error happened because the web directory is in examples and not together with the Neel package installed in the nimble package directory.If you look at the "devel" and "master" branch, you'll see that we use the spread operator. We removed it in the "devel2" branch because the spread operator and object methods (Object.values(x) etc.) isn't supported on an older JS rendering engine.
Thanks for the suggestion though! Please let me know if you have any more.
Thanks everyone for your replies, I know I'm super late. I will be taking the time this weekend to go through the branch and begin making necessary changes.
Apparently webview is a lot more difficult to pull off than simply using a Chrome window in App mode.
I'm thinking about wrapping the newer version of the c++ Webview library and start testing things from there.