Ubuntu – How to create the own webapp unity integration

firefoxlauncherunitywebapps

I'm trying to create some webapps to use with Firefox. I got an tutorial from Canonical (http://developer.ubuntu.com/resources/app-developer-cookbook/unity/integrating-tumblr-to-your-desktop/) and I didn't understand one thing, maybe someone could help me.

I have to run the following script in Web Console:

// ==UserScript==
// @name          tumblr-unity-integration
// @include       https://tumblr.com/dashboard
// @version       @VERSION@
// @author        WebApps Team
// @require       utils.js
// ==/UserScript==

window.Unity = external.getUnityObject(1.0);

Unity.init({ name: "Tumblr",
            iconUrl: "icon://Tumblr",
            onInit: null });

Everything is fine, it created the icon launcher and work with alt+tab. That enough for me by now, but, if I close the windows, the launcher icon that I created before stop working (I mean, it open the site, but doesn't work like other webapp and doesn't show in alt+tab too). Maybe I have to run this script automatically every time I enter on that site (In this example, Tumblr). How can I do that?

Thanks,

Best Answer

Yes you are right. You need to execute that again.

Basically webapps are user scripts which are executed everytime you enter on a determined website (in your case, https://tumblr.com/dashboard), which then provides the integration the website on the Unity desktop.

So if you want to make that "permanent" (execute that code everytime you enter on the website), either you can include that js on the website (if you own it) or use something like GreaseMonkey or TamperMonkey to include that script on websites which you do not control.

Of course, you can also create a package: see the source of unity-webapps-youtube for example.