Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/theseyan/bunview

Feature-complete webview library for Bun
https://github.com/theseyan/bunview

bun desktop-app gui webview

Last synced: 23 days ago
JSON representation

Feature-complete webview library for Bun

Awesome Lists containing this project

README

        




bunview





Feature-complete webview bindings for Bun



![Example Image](misc/bunview_intro.png)

Bunview is a cross-platform library to build web-based GUIs for desktop applications.

## Installation

```
bun add bunview
```

### Linux Prerequisites
The GTK and WebKit2GTK libraries are required for development and distribution. You need to check your package repositories regarding how to install those.

On Debian-based systems:

* Packages:
* Development: `apt install libgtk-3-dev libwebkit2gtk-4.0-dev`
* Production: `apt install libgtk-3-0 libwebkit2gtk-4.0-37`

## Usage

```js
import {Window, SizeHint} from "bunview";

let window = new Window(true);

window.on('ready', () => {
window.setTitle('Bunview');
window.navigate("https://bun.sh");
});
```

There is no documentation right now, hence the best place to start is [examples](https://github.com/theseyan/bunview/blob/main/examples).

## Limitations

- Setting `MIN` and `MAX` window size hints on macOS does not work, you must use either `FIXED` or `NONE`
- `Window.init` to inject Javascript preload does not work correctly on macOS

# Building from source
Bunview is written in Zig and compilation is fairly straightforward. The prerequisites are:
- Zig version [0.11.0-dev.944+a193ec432](https://ziglang.org/builds/zig-0.11.0-dev.944+a193ec432.tar.xz)

```bash
# Clone the repository and update submodules
git clone https://github.com/theseyan/bunview && cd bunview
git submodule update --init --recursive

# Build
zig build -Drelease-fast

# Move to build/ folder. Your binary name will differ based on OS/CPU.
mkdir build && mv zig-out/bin/bunview-x86_64-linux ./build/bunview-x86_64-linux

# Run example (must have Bun installed)
bun examples/main.js
```