I'd like to write my own local webapps userscripts, but I don't want to compile and install the main webapps source code every time.

I would like to keep the original Ubuntu Webapps package installed, but use my local userscripts as well. Is this possible?


What you could do is create your userscript and symlink it to /usr/share/unity-webapps/userscripts/unity-webapps-$NAME/$NAME.user.js:

($MYSCRIPTPATH is the full path to your script, probably somewhere in your home directory;$NAME is the name of your script)

sudo mkdir /usr/share/unity-webapps/userscripts/unity-webapps-$NAME
sudo ln -s $MYSCRIPTPATH /usr/share/unity-webapps/userscripts/unity-webapps-$NAME/$NAME.user.js

You'll also need to manually create a manifest file on /usr/share/unity-webapps/userscripts/unity-webapps-$NAME/manifest.json - you can just copy one from the other apps in the userscripts dir and modify the values according to your webapp.

  • You have to add your script in /usr/share/unity-webapps/userscripts/config.xml as well. Just copy and modify another entry. – Alistair Buxton Oct 14 '12 at 2:32
  • @AlistairBuxton, does this still apply? I can't find the /usr/share/unity-webapps/userscripts/config.xml file anywhere on my system. – David Planella Oct 20 '12 at 8:59
  • It still applies to 12.04. – Alistair Buxton Oct 20 '12 at 9:08
  • Can you tell me how to compile webapps userscripts? – Rajat Saxena Oct 26 '12 at 8:43
  • config.xml seems to be not needed in 12.10 – Stefano Jan 6 '13 at 18:27

I found an easy and secure way to create custom web apps: using Firefox and the Greasemonkey extension. In Greasemonkey, it's enough to create a user script like this (I've created for Asana):

// ==UserScript==
// @name        Asana
// @namespace   app.asana.com
// @include     https://app.asana.com/*
// @grant       none
// @version     1
// ==/UserScript==

window.Unity = external.getUnityObject(1);

Unity.init({ name: 'Asana',
             domain: 'app.asana.com',
             homepage: 'https://app.asana.com/',
             iconUrl: 'http://asana.com/assets/FluidIcon.png' 

This script simply enable the Unity integration, but you can add other features writing more code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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