2

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,

euDennis
  • 1,075

2 Answers2

3

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.

Salem
  • 19,874
  • 6
  • 65
  • 91
  • Thanks. Now I have two new -noob- questions:
    1. How can I see the source of the unity-webapps-youtube
    2. Where I can find more info about create my own package?
    – euDennis Mar 16 '13 at 23:58
  • apt-get source unity-webapps-youtube; 2) Here, but as in your case there is no need to compile anything, it should be a lot easier to just create a directory structure like unity-webapps-youtube and use dpkg. See here.
  • – Salem Mar 17 '13 at 00:18
  • My code worked in Firefox (Greasemonkey), but won't work in Chromium (Tampermonkey). Anyone know why? – euDennis Mar 29 '13 at 17:37
  • I made my own unity-webapp using the source from unity-webapps-launchpad. The result is that:

    https://github.com/eudennis/unity-webapps-feedly

    After that, I made my .deb file, but didn't work yet. Do you know if I made something wrong?

    – euDennis Mar 29 '13 at 19:18
  • One thing I notice in the sample script above is that two members are missing from the array passed to init(): "domain" and "homepage". So I think that argument should read: – monotasker Apr 11 '13 at 19:39
  • @monotasker this marks them as optional on 12.04, but it may be different on newer versions. – Salem Apr 11 '13 at 20:09
  • @euDennis check the consoles from Chromium of Firefox for errors. About the the GitHub repo, I think that will not work: you have Feedly.user.js on the root of the package, so it will be installed on /Feedly.user.js. I think it must be placed in /usr/share/unity-webapps/userscripts/<app_name>/Feedly.user.js. – Salem Apr 11 '13 at 20:12
  • I will try that. It's working on Firefox by now, maybe that affect chromium only. – euDennis Apr 13 '13 at 17:29
  • @Salem You're right. Sorry, I was just looking at the sample code on the Canonical site and comparing it with the source on Github. – monotasker Apr 16 '13 at 18:53