Gtk3 vs HTML5

The last few weeks I’ve been working on an interesting new idea, hacking out a prototype.

The code is not really clean enough for public consumption yet, and a bunch of features are missing. However, its now at the stage where it can be demoed and evaluated.

I think the best way to introduce it is via a video: (original theora file)

Basically, its a backend for Gtk+ 3 that renders in a browser.

A more techincal description for the web geeks among us:

Each toplevel window is mapped to a canvas element, and the content in the windows is updated by streaming commands over a multipart/x-mixed-replace XMLHttpRequest that uses gzip Content-Encoding to compress the data. Window data is pushed as region copies (for scrolling) and image diffs. Images are sent as data: uris of uncompressed png data.

Input is gathered via dom events and sent to the server using websockets.

Right now this is Firefox 4 only, but it could be made to work in any browser with websockets.

Now, I want to know, Is this useful?

There are two basic ways to use this, you can either run your own apps on your own server and access it from anywhere (kinda like screen). Or you can put it on a public server that spawns a new instance of the app for every user (gimp on a webpage!).

If you had this technology, what cool stuff would you do with it? What apps would you run, and how would you use them?

175 Responses to “Gtk3 vs HTML5”

  1. [...]   这里是作者的原文介绍,他同时建了一个名为Broadway的 GTK+分支来发布这套代码。不过,目前这套东西只能跑在 FireFox 4 上,但作者承诺今后会支持所有浏览器。 [...]

  2. Francesco says:

    What about multiple connection? is there always one thread?
    thanks for your work

  3. Richard says:

    (didn’t read all 151 other comments)

    It would at least be nice to demo applications before installing them.

    Also, using them, or having your own desktop available to a web browser (“Security!”)

  4. imploder says:

    > If you had this technology, what cool stuff would you do with it?

    I’d use it for a new version simple application – the Awkwords word generator (see the website). So far, it’s been a web application. I am planning to completely rewrite it for the 2.0 version and I’m not quite decided yet if the new one should be a web application again, or a desktop application. Many people find it convenient to use it on the Web but some have asked how to use it offline. For using it offline one has to install Apache, PHP and put the application in the web root. Not convenient, a real desktop app would be better for offline use.

    So, if it was possible with a good toolkit (which GTK presumably is) to develop an application that could be either installed as a classic desktop app or used remotely as a web app, I would use that for the new version of Awkwords. Everyone could either use it as before over a web interface, or install it locallly. I’d prefer a quality implementation, that is:
    – fast: it should run on slow connections sufficiently, as a normal web application would
    – compatible: supporting a variety of browsers

    Transmitting pixmaps is not a way to go – at least text and basic form widgets should be translated into HTML to save bandwidth and to enable the browser to see text as text, not image.

    The interface should be then operated offline (as it normally is in web applications, not counting AJAX), a message to the server would be sent only if the user does something that triggers a function in the application. That is, if I for example just change the text in a text field an I have no callback hooked on that in the application, it should be done completely client-side without contacting the server. Then, I would for example click the button “Generate” in my app – the client side would know my application has a function hooked on the click on that buttion, so it would send the state of the UI to the server and trigger the signal there.Similarly, if a change in the UI is made server-side, the server would trigger an update in the client-side UI. I think it could be done with GTK generating some javascript with AJAX. A javascript would have to listen with AJAX for server updates – there is a toolkit called APE ( http://www.ape-project.org ) for that.

    That’s just my ideas. I think the idea of having the same app accessible both as an offline installed app and as a web app is interesting.

  5. gogoliu says:

    It’s a step for gtk to become a RIA platform. It make X server become obsolete. But it’s not enough. Qt with QML is better. I expect the QML runtime for web browsers. But Flex is still the best choose.
    If the X/Gtk guys implement NeWS for linux in 1990s. The linux GUI architecture will ahead of the times. What a pity.

  6. gogoliu says:

    With the Lighthouse project, QT has a Google Native Client backend:
    http://labs.qt.nokia.com/2010/06/25/qt-for-google-native-client-preview/
    I think it’s not so hard for them to implement a HTML5 backend. QT everywhere is becoming true.

  7. Gustavo Noronha says:

    Awesome work! I would totally use liferea to read my feeds anywhere ;D

  8. [...] Gtk3 vs HTML5 « Alexander Larsson [...]

  9. jual beli says:

    There ise is clearly a lot to know about this. I believe you developedde some good points in FeatFeatures also.

  10. [...] Gtk3 vs HTML5 « Alexander Larsson – GNOME Blogs [...]

  11. [...] Alexander Larsson landed a “broadway” branch into GTK+, this adds a HTML backend to GTK+; he had written about this before in GTK+ 3 vs HTML 5. [...]

  12. tanisha says:

    Are you kidding?

    I have a bucket of apps that I make available as web apps now that I would way rather distribute as zero-configuration desktop apps which is what this looks like from a user point of view.

    I have an employee compensation reporting and benefits management system that I would way, WAY rather write in GTK+ than the current morass of HTML, CSS, and JavaScript that the GUI requires now.

  13. fethi says:

    “Using same library on desktop and web even without any plugins.”
    That’s sounds amazing.

    May be we can connect our linux desktops over web based remote desktop someday. huh! :)

    Thanks Alexander for great prototype.

  14. marcthenarc says:

    I agree with @tanisha: I can think of a number of “web” based games distributed under Firefox. No more javascript based widgets for me if this happens.

    Thanks. Let’s hope for a public release early this new year ;-)

  15. Andrius Bentkus says:

    At first I thought this was somekind of HTML5 + JavaScript backend (everything running in the browser). I almost jizzed in my pants.

    But sending PNG’s is still cool, though produces a LOT of traffic and is not for scalable web apps whatsoever: try running 1000 gimps.

    Though accessing your own special app with that would be possible.

  16. ses says:

    This could be a killer component for ChromeOS. Imagine ChromeOS + “legacy” GTK support inside the browser. Wow.

  17. [...] last few days I spent fixing up some more details in the new HTML5 gdk backend. Not everything is supported yet (keyboard input in particular is very weak), but much more things [...]

  18. zxq9 says:

    I know exactly what I would do with it. I would replace all of the closed-source ERP deployments we have with a Tryton back end.

    The only problem with this solution is the requirement to constantly update the PNG images at high speed. ERP deployments tend to extend across broad regions, so this could get weird. It could also get crazy when a user connects over a 3/4G phone wireless connection through their browser (Firefox/Chrome/Safari) and has to suffer through blocky breakages that a test environment is not subject to (because usually you are on the same LAN as the test system when building a new system).

    So basically, if this could be brought to perform well under significant network stress, it would be an amazing thing for business applications and move them light-years beyond the current AJAX dependent world (granted, HTML5 has the potential to move the world beyond Flash and AJAX on its own anyway, but…).

    Awesome idea. GTK on the web. Even if your current streaming PNG concept doesn’t work well under network stress, the concept of pushing GTK through the browser is so good that the sky really is the limit. Imagine *any* GTK app being available over the web. If it worked smoothly and reliably it would entirely solves the application server dilemma — and introduce a somewhat frightening SaaS revolution, come to think of it.

    Cheers!

  19. mr mike says:

    With me, the wife, and the kids all being gnome and xfce users at home, it would be fun to run off a central server at home with a UPS. Well, it would be fun for me at least…LOL.

    This would be great in a small office too I could imagine

  20. fujiyama says:

    This feature is awesome! AWESOME! I’m going to port my WinForms application to support this!

  21. [...] passato poco più di un mese da quando abbiamo segnalato il rilascio di GTK+ 3 e, secondo alcune anticipazioni, gli sviluppatori di GTK+ hanno intenzione di introdurre novità interessanti nelle… [...]