HTML 5 a GTK- Broadway: Aplikace v prohlížeči

GTK3 Broadway UbuntuHTML5 a GTK umožňuje provozování jakékoliv aplikace včetně např. Libre Office ve webovém prohlížeči. To je nová možnost pro poskytování aplikací „jako služby“ a zcela nové možnosti pro cloud computing.

Broadway

Broadway is the HTML5 back-end for GTK3 for displaying GTK+ applications within modern web-browsers:
https://www.phoronix.com/scan.php?page=search&q=Broadway
https://launchpad.net/~malizor/+archive/ubuntu/gtk-broadway

Using GTK+ with Broadway

Using GTK+ with Broadway — HTML-specific aspects of using GTK+

Using GTK+ with Broadway

The GDK Broadway backend provides support for displaying GTK+ applications in a web browser, using HTML5 and web sockets. 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.

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, broadwayd, that ships with GTK+. To use broadwayd, start it like this:

broadwayd :5

Then point your web browser at http://127.0.0.1:8085. Start your applications like this:

GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk3-demo

Broadway-specific environment variables

BROADWAY_DISPLAY Specifies the Broadway display number. The default display is 0. The display number determines the port to use when connecting to a Broadway application via the following formula:

port = 8080 + display

https://developer.gnome.org/gtk3/stable/gtk-broadway.html

Install GTK3 with Broadway backend enabled in Ubuntu

Important: The GTK+3 with the Broadway (HTML5) backend PPA is available for Ubuntu 13.04, 12.10 and 12.04 and provides the same GTK+3 version available for those Ubuntu versions (but obviously, with Broadway enabled). That means that if you’ve added some PPA which has a newer GTK3 version (like the GNOME 3 PPA), you won’t be able to use this PPA unless you purge the other PPA or downgrade the packages!
To add the GTK+3 Broadway PPA and upgrade to GTK3 with Broadway in Ubuntu, use the following commands:
sudo add-apt-repository ppa:malizor/gtk-broadway
sudo apt-get update
sudo apt-get upgrade

Then, log out, log back in and:

1. (Updated) For Ubuntu 13.10 or newer, open a terminal and type (not required for Ubuntu 12.04):
broadwayd

2. To run an application with the Broadway backend, use the following command:

GDK_BACKEND=broadway UBUNTU_MENUPROXY= LIBOVERLAY_SCROLLBAR=0 <APPLICATION>

where „APPLICATION“ is the GTK3 application executable. For instance, to run Gedit with the Broadway backend, use:

GDK_BACKEND=broadway UBUNTU_MENUPROXY= LIBOVERLAY_SCROLLBAR=0 gedit

„UBUNTU_MENUPROXY=“ and „LIBOVERLAY_SCROLLBAR=0“ are required because with the global menu and overlay scrollbars enabled, the applications segfault.

And finally, open Firefox (using Chrome didn’t work properly in my test) and enter the following address: http://localhost:8080

You can also use this from a remote machine, by entering your IP followed by the 8080 port. In my test, this also worked using Firefox on my Android phone.

To specify the port (if you use a different port for each app, they can run in the same time), use „BROADWAY_DISPLAY=“ followed by the port number (e.g.: BROADWAY_DISPLAY=8081) in the command used to launch the application.

Remember: you can only use this with GTK3 applications.
There is another PPA which provides the latest stable GTK 3.8 for Ubuntu 13.04, that comes with some extra features, like password protection, running multiple GTK+ applications in the same web browser and more, however, since Ubuntu 13.04 doesn’t come with GTK 3.8 by default, I don’t recommend using this unless you only want to test it in some virtual machine or you plan on using Broadway on a server. You can find the Ubuntu 13.04 GTK 3.8 with Broadway PPA HERE – make sure you read the PPA description since Broadway works a bit differently in GTK 3.8.

Reverting the changes

If you want to purge the GTK+3 Broadway PPA and go back to the GTK+3 version you had installed previously, use the following commands:
sudo apt-get install ppa-purge
sudo ppa-purge ppa:malizor/gtk-broadway