10

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?

2 Answers 2

6

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.

6
  • You have to add your script in /usr/share/unity-webapps/userscripts/config.xml as well. Just copy and modify another entry. Oct 14, 2012 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. Oct 20, 2012 at 8:59
  • It still applies to 12.04. Oct 20, 2012 at 9:08
  • Can you tell me how to compile webapps userscripts? Oct 26, 2012 at 8:43
  • config.xml seems to be not needed in 12.10
    – Stefano
    Jan 6, 2013 at 18:27
3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .