grundleborg

open source stuff

Plasmoids in a web page

Posted by grundleborg on May 30, 2008

After refactoring the core of decibel to be independent of KDE, I’ve decided to take a little break from my summer of code project while my mentor reviews all the changes I’ve made so far. So, instead of taking a holiday from KDE and computers for the last two days I’ve been working on a little project that I’ve wanted to do since I saw the idea mentioned by Aaron in an interview some time ago (when I googled for it this evening, I couldn’t find it again, so forgive me for not linking). I interpreted what he said as meaning “plasma doesn’t just need to revolutionise the desktop but could even spread into the internet space by having plasmoids on web pages”.

So, I set about making this possible. It was easier than I thought thanks to the wonderful trolls who recently released an Open Source QT addon that wraps the Netscape Plugin API. In fact, most of the two days I’ve spent getting this basic browser plugin made were spent tracking down the reason why adding a dependency on KDE stopped mozilla loading it – it turned out to be “-fvisibility=hidden” that is added to the CXX_COMPILER_FLAGS by FindKDE4.cmake.

Now, don’t get excited yet – this really is rudimentary, but there is now a plugin that works with firefox (not tested with anything else yet) and allows web pages to contain plasmoids. It uses the plasmoids already installed on your computer, but in the future I can envision it allowing scripted plasmoids provided by the web site you are visiting. Also, at the moment it only allows embedding of individual plasmoids, but again in future it could allow embedding of containments – you could even have a page that allows rearranging of plasmoids much like how you can rearrange the boxes on your Facebook profile. You could even perhaps drag plasmoids from a web page to your desktop! The posibilites seem endless… (Apologies to Aaron and other plasma devs for any ideas here that are not original and that I poached from them and then forgot about!)

Anyway, bringing my imagination back down to earth, here’s a screenshot of what’s already possible.

Large version

The clocks all work, honest 🙂 (The only major known bug is that the right click menu text doesn’t show up, but I have a feeling that someone with more KDE-fu than me will fix that in a heartbeat).

If you want to have a look for yourself, the code is currently in available here in a git repo. Check out the master branch, then compile it in you KDE4 build environment (you will need very recent trunk), and it should Just Work (TM). See the README file for random ramblings about how to debug when it doesn’t :).

Enough of that sidetrack! Tomorrow I return to Decibel (which I will blog about again shortly as a huge amount has and is happening on that front). Also, there’s a bug day this Sunday… you know the drill by now, and if you don’t, watch the planet for a dedicated blog about that soon.

UPDATE: This approach currently does not work for Konqueror, but it has been pointed out to me that it is already possible to embed local plasmoids in Konqueror via a kpart. Details on Harri Porten’s blog.

Advertisements

26 Responses to “Plasmoids in a web page”

  1. Brilliant! I can envision this as a true FOSS alternative to Flash and Silverlight!

  2. patcito said

    That’s cool, by using Qt’s phonon and svg support, we could have a nice free flash replacement.

  3. Dave Taylor said

    Is Theora ‘streamable’ because as patcito says above with Phonon this could make a superior embedded video player.

  4. Thumb down for Adobe! xD Booooooo!

  5. Hats off! This is really cool 🙂

  6. markc said

    Sounds cool but I’m getting errors trying to clone your project and even getting a snapshot is a zero length tarball. I’d like to package this up with some ArchLinux daily svn binaries that I build.

  7. grundleborg said

    @markc

    I’ll have a look and see if I screwed something up with that git repo. Thats really cool that you want to package it! Its a cool little piece of software even though its got a long way to go to being something actually functional.

  8. grundleborg said

    @markc

    I’m able to clone from the public repo just fine here. Are you doing: “git clone git://repo.or.cz/plasmaplugin.git” ?

  9. patcito said

    @Dave: one of the primary use of theora is to be streamable, so yes, Theora is streamable 🙂 But phonon works with whatever codec supported by its backend. So if you use ffmpeg or xine or gstreamer as phonon backend you get support for all these.

  10. Anonymous said

    How is it that all clocks in konqueror always show 17:20 (independent of the actual time of day!)

  11. grundleborg said

    @Anonymous

    Because you’re looking at a screenshot! You need to download and compile the plugin and then use the example HTML file included if you want to see the actual plasmoids for real.

  12. patpi said

    Here is the mentioned aarons interview. -> http://www.computerworld.com.au/index.php/id;885892575;pp;2

  13. vivo75 said

    OMG so now it’s possible to embed webkit in firefox 🙂

  14. Sinok said

    Funny, it’s exactly the same thing that Sun revealed at JavaOne (the biggest java conference in the world) for their applets, that are going to reach another level with the new version of the JVM. The java processwill be now independant from the browser, and you will be able to drag applets from the browser to the desktop, and they will still live even if the browser is closed.
    Video here http://news.zdnet.com/2422-13568_22-200560.html

    and they even have a clock…

  15. SadEagle said

    It actually does work in Konqueror if you alter the markup slightly, to something like this:

    Unfortunately object embedding is one of the quirkiest areas of the web 😦

    As to why the changes… KHTML doesn’t like URL-less elements which don’t have a classId and for which serviceType cannot be determined, rendering alternate content for them. This probably should change to about:blank if serviceType is text/html, at least; and for other mimetypes it probably should not pass a URL at all (needs to remove completeURL call in this case, though — hmm, that may explain some of the self-embedding bugs). The quirky/non-standard passing of attributes to the part is also only done for the non-standard and the deprecated , but if iceweasel does it for as well, I guess we have to as well (all it takes is removing an if)

  16. SadEagle said

    Woops, looks like it strips markup and doesn’t auto-escape it.
    Let’s try with square braces:
    [object id=”Plasmoid1″ data=”data:application/plasmoid,” WIDTH=400 HEIGHT=200]
    [param name=”applet” value=”digital-clock”]
    [/object]

  17. eddie said

    This is a completely unexpected development of plasma by my side. plasma in the browser (hello kde4 on windows, hello flash, silverlight and javafx), plasma in the desktop and synergy flows between them. I would like to hear more about this.

  18. Joe Kowalski said

    The biggest problem with getting plasmoids out to a wide market in the browser is that distributing this out & installing it in an efficient manner will take a fair bit of work. Qt on windows itself is several megabytes, and plasma has pretty deep dependencies on kdelibs, which amount to several more megabytes, so a simple distributable for just running plasmoids in your web browser will likely weigh in at 20+MB, which when compared to flash at just a couple of megs, is quite heavy.

  19. Snowflake said

    @Joe Kowalski

    That would be one of my concerns too. There are just not enough people who could use this because of missing applications (qt/kdelib) on there computer.
    Even though I think the 20+MB are still ok compared to flash. There were quite few good ideas which have been mentioned here. Most of all the idea of sharing plasmoids with a webpage and your desktop. This is something really new. And with a fast progress KDE might becomes a pioneer on this.

  20. jt said

    Sounds like a security nightmare.

  21. jau said

    sounds like reinventing activeX (ouch)

  22. AAk said

    Wow, plasmoids in web pages, that sounds a lot like another technology to me … no, not flash … yes, you got it, activeX. Beware, putting a technology inside a web page is not just about its efficiency, it’s also a lot about its safety/security.

  23. […] firefox, kde, plasma, plasmaplugin, windows You might remember some months ago that I posted a proof-of-concept plasma plugin for Mozilla Firefox on Linux. Well, a lot of tweaking later, we can now see a wide assortment of […]

  24. Anonymous said

    What about security?

  25. […] great to see the plasma browser plugin being mentioned and played with again. I plan to work on making it more than just a […]

  26. JJ said

    I really found very wild that thing of dragging plasmoids from a page to your desktop!

    While I was reading (yes, I noticed it’s an old post but I just found it), I thought kde-apps could use it (so we’d see a live working preview of the plasmoid on the page, before installing) but, combined to that dragging idea (sure, an Install button would still be needed but), not only kde-apps would rock but “Install plasmoids from the web” feature on our desktop could just link to that page. So, after seeing if the plasmoid is what you expect before install it, you decide if you’ll drag or click a button to place it on your desktop. Just as simple! Would just rock, rock, rock!

    How is progress on that?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: