Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create some webapps to use with Firefox. I got an tutorial from Canonical ( 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
// @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?


share|improve this question
up vote 3 down vote accepted

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,, 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.

share|improve this answer
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
1) 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 0: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: 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

Here's how to integrate the script into Ubuntu "properly," short of making an install package. I'm including at each stage the terminal commands to do what I describe. For the sake of generality this assumes you are integrating an app called "Mysite." (I'm giving more explicit instructions here than the op probably needs, but I want to make sure it's useful for those with less Linux mileage.)

  1. Create a subfolder for your app under the /usr/share/unity-webapps/userscripts/ directory. For consistency it's good to name your folder unity-webapps-.

    cd /usr/share/unity-webapps/userscripts
    sudo mkdir unity-webapps-mysite

  2. Move your integration script (with the user.js extension) to the directory you just created:

    sudo mv ~/somefolder/Mysite.user.js /usr/share/unity-webapps/userscripts/unity-webapps-mysite/

  3. Create a new file in that same directory called manifest.json:

    cd /usr/share/unity-webapps/userscripts/unity-webapps-mysite sudo touch manifest.json

  4. Open that manifest.json file in your favourite text editor:

    sudo nano manifest.json

  5. Add to that empty file the metadata required for webapp integration. This metadata should be based on the opening comments section of your integration script. Here is a basic boilerplate manifest file for our Mysite script:

    {"includes":["", ""],
    "maintainer":"Me ",
    "48":"48/unity-webapps-mysite.png", "52":"52/unity-webapps-mysite.png", "64":"64/unity-webapps-mysite.png"}, "domain":"",

  6. Create a square icon for your app at least 128px by 128px and make resized copies that are 64x64, 52x52, and 48x48. (I just use gThumb image viewer for this. GIMP also works.) You need to give all of the files the same name (unity-webapps-mysite.png) so you may want to create separate folders for each one called "128" "64" "52" and "48" to keep the files straight.

  7. Copy these image files to the appropriate subfolders of the directory /usr/share/icons/unity-webapps-applications/apps. If you have the webapps package already installed these subfolders should already exist.

    sudo mv ~/somefolder/128/unity-webapps-mysite.png /usr/share/icons/unity-webapps-applications/apps/128/
    sudo mv ~/somefolder/64/unity-webapps-mysite.png /usr/share/icons/unity-webapps-applications/apps/64/
    sudo mv ~/somefolder/52/unity-webapps-mysite.png /usr/share/icons/unity-webapps-applications/apps/52/
    sudo mv ~/somefolder/48/unity-webapps-mysite.png /usr/share/icons/unity-webapps-applications/apps/48/

Your webapp should now be integrated into Unity! You should be able to find it be searching the applications lens of the Unity dash and then (if you want) pin it to your Unity launcher. It's possible that the icon won't be picked up immediately, but in that case just log out and log in again. Your webapp should now appear in all its iconic glory.

What I don't know is whether updates to the official unity-webapps-applications package will remove any of these files, so I'm working on figuring out how to package a script as a .deb and install it. But I'm unclear about that part. One way or the other you will want to make sure you have a backup of everything in your home folder just in case.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.