Skip to content

Commit 55dc700

Browse files
committed
Merge branch 'main' of https://github.com/ilpropheta/bonnet
2 parents 4c6fe2c + a191ad8 commit 55dc700

File tree

1 file changed

+99
-1
lines changed

1 file changed

+99
-1
lines changed

README.md

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,100 @@
11
# bonnet
2-
Tiny webview-based application launcher for Windows
2+
3+
`bonnet` is a Windows program that allows you to open a webpage into a self-hosted window and, optionally, to launch a backend process.
4+
5+
## Installation
6+
7+
`bonnet` is just an executable that depends on:
8+
- [Visual C++ runtime](https://aka.ms/vs/17/release/vc_redist.x64.exe)
9+
- [WebView2 runtime](https://developer.microsoft.com/en-us/microsoft-edge/webview2/)
10+
11+
Be sure you have both installed on your system to use bonnet.
12+
13+
## Usage
14+
15+
By default, `bonnet` launches `https://google.com` on a `1024x768` window.
16+
17+
To display the available commands, type `bonnet --help`:
18+
19+
```
20+
Launch your front-end and back-end with a single command
21+
Usage:
22+
bonnet [OPTION...]
23+
24+
--help Display this help
25+
--width arg Window width (default: 1024)
26+
--height arg Window height (default: 768)
27+
--title arg Window title (default: bonnet)
28+
--icon arg Window icon path (default: "")
29+
--fullscreen Fullscreen borderless mode
30+
--url arg Navigation url (default: https://google.com)
31+
--backend arg Backend process (default: "")
32+
--backend-workdir arg Backend process working dir (default: "")
33+
--backend-args arg Backend process arguments (default: "")
34+
--backend-console Show console of backend process
35+
--backend-no-log Disable backend output to file
36+
--debug Enable build tools
37+
--no-log Disable all logs to file
38+
```
39+
40+
By default, `bonnet` creates a log file `bonnet.txt` on the current directory. To disable logging, you can add `--no-log`.
41+
42+
Some examples:
43+
44+
### Customize window
45+
46+
```
47+
bonnet --width 500 --height 500 --title "Italian C++ Community" --icon c:\icons\myicon.ico
48+
```
49+
50+
### Webpage fullscreen
51+
52+
```
53+
bonnet --fullscreen --url https://italiancpp.org
54+
```
55+
56+
To close the window here, possibly your website does not hinder `ALT+F4`.
57+
58+
### Enable developer tools
59+
60+
Use `--debug` to enable developer tools:
61+
62+
```
63+
bonnet --fullscreen --url https://italiancpp.org --debug
64+
```
65+
66+
<img src="https://user-images.githubusercontent.com/5806546/194514328-62710b32-7ebd-41ef-b95a-a8f1f30de785.png" alt="drawing" width="350"/>
67+
68+
### Custom backend process
69+
70+
```
71+
bonnet --fullscreen --url https://your-frontend --backend your-exe.exe
72+
```
73+
74+
Arguments can be added with `--backend-args=arg1,arg2,...`:
75+
76+
```
77+
bonnet --fullscreen --url https://italiancpp.org --backend your-exe.exe --backend-args=arg1,arg2
78+
```
79+
80+
By default, bonnet logs the backend's standard output into `bonnet.txt`. To disable only such logging, use `backend-no-log`.
81+
82+
Also, you can show the backend process into its own console (in this case, standard output won't be logged to file):
83+
84+
```
85+
bonnet --fullscreen --url https://italiancpp.org --backend your-exe.exe --backend-args=arg1,arg2 --backend-console
86+
```
87+
88+
You can even customize the backend process working directory with `backend-workdir path`.
89+
90+
Last but not least, when `bonnet`'s window is closed, the backend process will receive a `CTRL+C`. Thus, for correctly handling this graceful shutdown, it's mandatory that your backend process is a console application and that you **don't** launch bonnet with [`START /B`](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/start).
91+
92+
## Development
93+
94+
`bonnet` is written in C++20 with the support of:
95+
- [cxxopts](https://github.com/jarro2783/cxxopts)
96+
- [webview](https://github.com/webview/webview)
97+
- [tiny-process](https://gitlab.com/eidheim/tiny-process-library)
98+
- WebView2 [nuget package](https://www.nuget.org/packages/Microsoft.Web.WebView2)
99+
100+
For simplicity, the latter only is installed as a Nuget package into the project, the others are stored in `deps/`.

0 commit comments

Comments
 (0)