2021-02-10 14:03:56 +00:00
|
|
|
Title: The Broadway windowing system
|
|
|
|
Slug: broadway
|
|
|
|
|
|
|
|
## Using GTK with Broadway
|
2020-05-24 14:55:02 +00:00
|
|
|
|
2021-03-31 19:06:54 +00:00
|
|
|
The GDK Broadway backend provides support for displaying GTK applications in
|
|
|
|
a web browser, using HTML5 and web sockets.
|
2020-05-24 14:55:02 +00:00
|
|
|
|
2021-03-31 19:06:54 +00:00
|
|
|
To run your application in this way, select the Broadway backend by setting
|
|
|
|
`GDK_BACKEND=broadway`. Then you can make your application appear in a web
|
|
|
|
browser by pointing it at `http://127.0.0.1:8080`. Note that you need to
|
|
|
|
enable web sockets in your web browser.
|
2020-05-24 14:55:02 +00:00
|
|
|
|
2021-03-31 19:06:54 +00:00
|
|
|
You can choose a different port from the default 8080 by setting the
|
|
|
|
`BROADWAY_DISPLAY` environment variable to the port that you want to use.
|
|
|
|
|
|
|
|
It is also possible to use multiple GTK applications in the same web browser
|
|
|
|
window, by using the Broadway server, `gtk4-broadwayd`, that ships with GTK.
|
|
|
|
To start the Broadway server use:
|
2020-05-24 14:55:02 +00:00
|
|
|
|
|
|
|
```
|
2021-03-31 19:06:54 +00:00
|
|
|
gtk4-broadwayd :5
|
2020-05-24 14:55:02 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Then point your web browser at `http://127.0.0.1:8085`.
|
2021-03-31 19:06:54 +00:00
|
|
|
|
|
|
|
Once the Broadway server is running, you can start your applications like
|
|
|
|
this:
|
2020-05-24 14:55:02 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
|
|
|
|
```
|
|
|
|
|
2021-02-10 14:03:56 +00:00
|
|
|
## Broadway-specific environment variables
|
2020-05-24 14:55:02 +00:00
|
|
|
|
2021-03-31 19:06:54 +00:00
|
|
|
### `BROADWAY_DISPLAY`
|
2020-05-24 14:55:02 +00:00
|
|
|
|
|
|
|
Specifies the Broadway display number. The default display is 0.
|
2021-03-31 19:06:54 +00:00
|
|
|
|
|
|
|
The display number determines the port to use when connecting to a Broadway
|
|
|
|
application via the following formula:
|
|
|
|
|
|
|
|
```
|
|
|
|
port = 8080 + display
|
|
|
|
```
|