[ANNOUNCE] Greenfield and Web applications

Erik De Rijcke derijcke.erik at gmail.com
Tue Mar 19 20:28:38 UTC 2019


Nothing major but I thought I would be cool to share :)

As some of you already know, Greenfield can run remote Wayland applications
from different hosts. But as of recently, it can do more as well.

Run applications directly inside the user's browser.

This can be done using a Web worker. A Web Worker is essentially a
stand-alone thread/process in your browser, completely separate from the
main thread. Running applications in a Web Worker isolates client code
without impacting the performance of the compositor and provides isolation
from malicious clients.

Greenfield supports web applications. There are however some prerequisites.

- Web applications must be written in JavaScript (or WebAsembly) so they
can run in a Web Worker.
- A Web application must render it's content to an ArrayBuffer as Web
Workers do not have access to the DOM and as such can not use HTML to
render their content.
- Alternatively web applications can render to an off-screen WebGL
accelerated HTML5 canvas. Unfortunately this is still an experimental HTML5
spec.
- A Web application must communicate with the compositor using a custom
Wayland buffer protocol.

A Wayland Web application can run directly inside the browser without the
drawbacks of network latency or server load, while still being able to
interop (copy/paste & drag'n drop) with native server-side applications
running directly next to it.

There are currently 2 small demo web clients available in the Greenfield
repository that you can check out:
https://github.com/udevbe/greenfield/tree/master/demo-web-clients

simple-web-shm. Based on weston-simple-shm. Draws psychedelic cirkels. Uses
array buffers as shared memory between the compositor and the client.
Supported on Firefox and Chrome.
simple-web-gl. Draws a rotating square. Uses offscreen WebGL and streams
it's updates to the compositor using HTML5 ImageBitmaps. Only supported on
Chrome.

tl;dr Run JavaScript Wayland applications directly in your browser:
https://preview.greenfield.app

cheers,

Erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20190319/09653c5e/attachment.html>


More information about the wayland-devel mailing list