Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/webui-dev/nim-webui

Use any web browser as GUI, with Nim in the backend and HTML5 in the frontend.
https://github.com/webui-dev/nim-webui

bindings browser chrome chromium cross-platform edge firefox javascript nim nim-lang nimble safari ui web webui wrapper

Last synced: 29 days ago
JSON representation

Use any web browser as GUI, with Nim in the backend and HTML5 in the frontend.

Lists

README

        

![Logo](https://raw.githubusercontent.com/webui-dev/webui-logo/main/webui_240.png)

# WebUI Nim

[last-commit]: https://img.shields.io/github/last-commit/webui-dev/nim-webui?style=for-the-badge&logo=github&logoColor=C0CAF5&labelColor=414868
[release-version]: https://img.shields.io/github/v/tag/webui-dev/nim-webui?style=for-the-badge&logo=webtrees&logoColor=C0CAF5&labelColor=414868&color=7664C6
[license]: https://img.shields.io/github/license/webui-dev/nim-webui?style=for-the-badge&logo=opensourcehardware&label=License&logoColor=C0CAF5&labelColor=414868&color=8c73cc

[![][last-commit]](https://github.com/webui-dev/nim-webui/pulse)
[![][release-version]](https://github.com/webui-dev/nim-webui/releases/latest)
[![][license]](https://github.com/webui-dev/nim-webui/blob/main/LICENSE)

> Use any web browser or WebView as GUI, with Nim in the backend and modern web technologies in the frontend, all in a lightweight portable lib.

![Screenshot](https://github.com/webui-dev/webui/assets/16948659/39c5b000-83eb-4779-a7ce-9769d3acf204)

## Features

* Fully Independent (*Only needs a web browser or a WebView at runtime*)
* Lightweight & Small memory footprint
* Fast binary communication protocol between WebUI and the browser
* Multi-platform & Multi-Browser
* Using private profile for safety
* Cross-platform WebView

## Screenshot

This [text editor example](https://github.com/neroist/webui/tree/main/examples/text_editor) is written in Nim using WebUI as the GUI library.

![ScreenShot](nim_example.png)

## Installation

Install via Nimble:

```shell
nimble install webui
```

## Documentation

Online documentation can be found here:
-
- (same thing but made in nimib)

I suggest to get started using some [examples](#examples) or WebUI's own [examples](https://github.com/webui-dev/webui/tree/main/examples) or [documentation](https://webui.me/docs/).

Heres a very [*minimal*](examples/minimal.nim) example of using the wrapper:

```nim
import webui

let window = newWindow() # Create a new Window
window.show("Hello") # Show the window with html content

wait() # Wait until the window gets closed
```

### Examples

Examples can be found here at [`examples/`](examples/).

If you're trying to run the examples remember to clone the repository *recursively*, as it depends on the WebUI repo as a submodule. Here's the command to do so for the truly lazy:

```shell
git clone --recursive https://github.com/neroist/webui.git
```

## Bindings and Wrapper

The Nim library exposes two files: `webui.nim` and `webui/bindings.nim`.
`webui/bindings.nim` are low-level bindings for WebUI, generated by
[c2nim](https://github.com/nim-lang/c2nim). `webui.nim` is a high-level wrapper for
WebUI, using native Nim types and avoiding pointers.

The wrapper and bindings also allow to to control whether or not to statically
compile WebUI's C sources into your application, compile with a static library, or
to depend on a DLL. Static compilation is the default behavior.

To compile with a static library, pass `-d:useWebviewStaticLib` or
`-d:useWebviewStaticLibrary` to the Nim compiler. To depend on a DLL, pass
`-d:useWebviewDll` instead. If neither of these flags are passed to the Nim
compiler, static compilation will take place instead. Static libraries and DLLs can
be found in WebUI's website [here](https://webui.me/#download).

In addition, you can also enable WebUI's logging via `-d:webuiLog` but that flag
only works for static compilation.

## Other Wrappers/Bindings

| Language | Status | Link |
| ----------------------- | -------------- | --------------------------------------------------------- |
| Go | ✔️ | [Go-WebUI](https://github.com/webui-dev/go-webui) |
| Nim | ✔️ | [Nim-WebUI](https://github.com/webui-dev/nim-webui) |
| Pascal | ✔️ | [Pascal-WebUI](https://github.com/webui-dev/pascal-webui) |
| Python | ✔️ | [Python-WebUI](https://github.com/webui-dev/python-webui) |
| Rust | ✔️ | [Rust-WebUI](https://github.com/webui-dev/rust-webui) |
| TypeScript / JavaScript | ✔️ | [Deno-WebUI](https://github.com/webui-dev/deno-webui) |
| V | ✔️ | [V-WebUI](https://github.com/webui-dev/v-webui) |
| Zig | ✔️ | [Zig-WebUI](https://github.com/webui-dev/zig-webui) |
| Odin | _not complete_ | [Odin-WebUI](https://github.com/webui-dev/odin-webui) |
| Delphi | ✔️ | [WebUI4Delphi](https://github.com/salvadordf/WebUI4Delphi)|
| QuickJS | ✔️ | [QuickUI](https://github.com/xland/QuickUI) |

## Supported Web Browsers

| Browser | Windows | macOS | Linux |
| --------------- | --------------- | ------------- | --------------- |
| Mozilla Firefox | ✔️ | ✔️ | ✔️ |
| Google Chrome | ✔️ | ✔️ | ✔️ |
| Microsoft Edge | ✔️ | ✔️ | ✔️ |
| Chromium | ✔️ | ✔️ | ✔️ |
| Yandex | ✔️ | ✔️ | ✔️ |
| Brave | ✔️ | ✔️ | ✔️ |
| Vivaldi | ✔️ | ✔️ | ✔️ |
| Epic | ✔️ | ✔️ | _not available_ |
| Apple Safari | _not available_ | _coming soon_ | _not available_ |
| Opera | _coming soon_ | _coming soon_ | _coming soon_ |

## Supported WebView Platforms

| WebView | Status |
| ----------------- | ----------------- |
| Windows WebView2 | ✔️ |
| Linux GTK WebView | ✔️ |
| macOS WKWebView | ✔️ |

## License

MIT License. See [LICENSE](LICENSE)

Original WebUI library is licensed under MIT. See
[LICENSE](https://github.com/webui-dev/webui/blob/main/LICENSE).