How to create a local webapp userscript

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.


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.