Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/theseyan/bunview
- Owner: theseyan
- Created: 2022-12-26T06:35:12.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-30T06:32:41.000Z (almost 2 years ago)
- Last Synced: 2024-11-14T15:57:13.393Z (about 1 month ago)
- Topics: bun, desktop-app, gui, webview
- Language: Zig
- Homepage:
- Size: 91.8 KB
- Stars: 69
- Watchers: 5
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![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
```